git clone 'git://github.com/dgutov/diff-hl.git'
diff-hl-mode highlights uncommitted changes on the left side of the window,
allows you to jump between and revert them selectively.
For the usage instructions and the list of commands, see the Commentary section inside the file.
Tested with Git, Mercurial, Bazaar and SVN. May work with other VC backends, too.
The package also contains auxiliary modes:
diff-hl-dired-modeprovides similar functionality in Dired.
diff-hl-margin-modechanges the highlighting function to use the margin instead of the fringe.
diff-hl-amend-modeshifts the reference revision back by one.
Check out the Commentary section in each respective file for the usage instructions.
Top window: a buffer in this minor mode, bottom window: the corresponding diff.
Emacs 24+. On OS X, Emacs 24.3 or higher is recommended.
Since it uses the corresponding VC diff command, it's only accurate when the
buffer is in saved state. Highlighting changes “on the fly” might be better,
maybe we can do something similar to
highlight-markup-buffers with a hidden
buffer containing the unmodified copy.
We conflict with other modes when they put indicators on the fringe, such as Flycheck. This is rarely a significant problem, since if you're using such a mode, you'd usually want to fix all errors and warnings before continuing, and then the conflicting indicators go away.
There's no fringe when Emacs is running in the console, but the navigation
and revert commands still work. Consider turning
to show the indicators in the margin instead.
Frame-local and buffer-local values of
line-spacing are not supported.
emacs-git-gutter shows indicators in the margin by default, allows you to customize how the indicators look more easily, and has a “stage hunk” command.
If you're using some package other than
vc to commit changes, it might
vc-checkin-hook after commits. In that case, you'll need to
diff-hl-update to the hook it does run, or advise some
function that's called in the buffer after its state has changed.
(defadvice svn-status-update-modeline (after svn-update-diff-hl activate) (diff-hl-update))
If you have a recent enough version installed, it defines
magit-not-reverted-hook), which we use.