Diff/merge prompt when a file has both externally saved and local changes?



  • When using multiple editors or interacting systems, it will sometimes be the case that a file you were working on in NPP has in the meantime been saved from some other context. Even with the scary-sounding “Update silently” option, NPP then correctly prompts you with something like “Do you want to reload and lose your changes?”

    As a user, faced with this prompt, I typically groan, and then start the routine:

    • Say no to the prompt - I don’t want to lose my changes
    • Save my changes as a new file
    • Fire up a diff program to figure out what changed (and load the two files)
    • Manually apply my NPP-local changes (in the meantime saved to some other file) to the changed-elsewhere file

    This could be made much more pleasant, with a “Diff/Merge” button in the original pop-up prompt, that basically did all these things for you:

    • Saved a copy of your version
    • Saved a copy of the new version
    • Presented both to a (potentially/probably interactive) diff/merge program as configured, with a specified output file
    • After exit, took the merged output, replaced your local buffer with it, and checked whether it was safe to save (whether the underlying file was still the same as the version you merged)
    • If safe, save (and delete all three temp files). If the file has changed again, start again (same prompt)

    Is this the right place for feature requests liker this?

    (does anyone know whether this could be done with a plugin? I would assume that prompt is not extensible, but would love to be pleasantly surprised!)



  • Probably not extending that prompt. But how about:

    • Say no to the prompt - I don’t want to lose my changes
    • Plugins => Compare => Diff since last Save
    • Make edits / merges directly in Notepad++
    • Bob’s your uncle.

    Cheers.


Log in to reply