Sublime Forum

Improve the diff shown by 'show unsaved changes'


I use the ‘show unsaved changes’ right-click menu function a lot. The diff shown in the dedicated panel has its own line numbering in the gutter that doesn’t match the actual line numbers of the code, and to me this is a little annoying.

I think that using the diff view of Sublime Merge, instead of just the output of the diff command, would be really a great improvement of this function.




Maybe ST4’s inline diff feature is for you then? It would display old and new content using phantoms.

for usage see:

I’d sometimes prefer to have a Sublime Merge style side-by-side diff for things like that as well though.

It could make use of the new tab multiselect feature to avoid creating groups as the Compare Side-By-Side package does.



You can make a simple plugin to toggle all the diffs to get all the diffs in the current file.

import sublime
import sublime_plugin

class ToggleAllDiffsCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        sel = self.view.sel()
        old_sel = list(sel)
        sel.add(sublime.Region(0, self.view.size()))
        self.view.run_command("toggle_inline_diff", {"args": {"prefer_hide": True}})

And an entry to your Context.sublime-menu

    { "id": "diff", "caption": "Toggle All Diffs", "command": "toggle_all_diffs", },


Possibility to preview changes in a text file

Once in a while, we come a cross something very, very nice like this.

1 Like