Sublime Forum

Possibility to preview changes in a text file


I would like to have an option to highlight changes in a text file I did since it was last saved (either a form to browse through them like in find option or to highlight the lines like VS does). I can’t find any info on the internet nor in the Sublime app itself if the app has such feature named differently or not.

Sublime stores changes without saving the original file - and that’s awesome. Sometimes though I made a lot of changes and… it seems I forgot to save them. Sublime asks about saving a file only when the file is supposed to be closed - by that time I can hardly tell if I simply misclisked something on my keyboard or I’m so forgetfull I forgot to save something big.



There are actually several ways you can do that.

  1. If your text file happens to be something that is tracked by git, then it is very easy to see what changes you have made to the file before committing them either using the git command line or via any GIT GUI tools like Sublime Merge (But I assume this probably isn’t your case).

  2. You can use the incremental diff functionality of ST. Long story short, this functionality allows you to see changes you made to your files from the last time you closed it (Indicated by the gutter indicators as mentioned in the documentation). It’s controlled by the mini_diff setting (which is true by default) so you can use it right away. If you want to see all of the diffs at once, this forum post explains how one could do it using a simple plugin Improve the diff shown by 'show unsaved changes'

  3. If you want to see the unsaved changes you made to the file (you haven’t saved the file yet, but before saving you’d like to review something), then use the Show Unsaved Changes menu item from the context menu (i.e. right click on the unsaved document and choose Show Unsaved Changes). It will open up a panel at the bottom showing you a diff of when the file was opened and the changes you made before saving. Note that it’s not as human readable as (2), but it is still an option.

1 Like


Git would be only useful if I save all the changes, before that I wouldn’t have the chance to check it (as far as I know).

but still I would love to have that in one place, where I edit the file - Incremental Diff an Show Unsaved Changes both sound like something I’m looking for!

Thank you for the tips! They are life-saving ^^