Sublime Forum

Improve the diff shown by 'show unsaved changes'

#1

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.

Bye

0 Likes

#2

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

for usage see: https://www.sublimetext.com/docs/incremental_diff.html

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.

0 Likes

#3

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.clear()
        sel.add(sublime.Region(0, self.view.size()))
        self.view.run_command("toggle_inline_diff", {"args": {"prefer_hide": True}})
        sel.clear()
        sel.add_all(old_sel)

And an entry to your Context.sublime-menu

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

4 Likes

#4

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

1 Like