All Projects → dgutov → Diff Hl

dgutov / Diff Hl

Licence: gpl-3.0
Emacs package for highlighting uncommitted changes

Projects that are alternatives of or similar to Diff Hl

Spacemacs Theme
Light and dark theme for spacemacs that supports GUI and terminal
Stars: ✭ 483 (-12.66%)
Mutual labels:  emacs
Ggtags
Emacs frontend to GNU Global source code tagging system.
Stars: ✭ 515 (-6.87%)
Mutual labels:  emacs
Crux
A Collection of Ridiculously Useful eXtensions for Emacs
Stars: ✭ 543 (-1.81%)
Mutual labels:  emacs
Elsa
Emacs Lisp Static Analyzer
Stars: ✭ 485 (-12.3%)
Mutual labels:  emacs
Docker.el
Manage docker from Emacs.
Stars: ✭ 511 (-7.59%)
Mutual labels:  emacs
Php Mode
A powerful and flexible Emacs major mode for editing PHP scripts
Stars: ✭ 522 (-5.61%)
Mutual labels:  emacs
Jupytext
Jupyter Notebooks as Markdown Documents, Julia, Python or R scripts
Stars: ✭ 4,969 (+798.55%)
Mutual labels:  version-control
Telega.el
GNU Emacs telegram client (unofficial)
Stars: ✭ 551 (-0.36%)
Mutual labels:  emacs
Import Js
A tool to simplify importing JS modules
Stars: ✭ 511 (-7.59%)
Mutual labels:  emacs
Emacs Ng
A new approach to Emacs - Including TypeScript, Threading, Async I/O, and WebRender.
Stars: ✭ 525 (-5.06%)
Mutual labels:  emacs
Sparkleshare
Share and collaborate by syncing with any Git repository instantly. Linux, macOS, and Windows.
Stars: ✭ 4,661 (+742.86%)
Mutual labels:  version-control
Prelude
Prelude is an enhanced Emacs 25.1+ distribution that should make your experience with Emacs both more pleasant and more powerful.
Stars: ✭ 4,735 (+756.24%)
Mutual labels:  emacs
Robe
Code navigation, documentation lookup and completion for Ruby
Stars: ✭ 525 (-5.06%)
Mutual labels:  emacs
Remacs
Rust ❤️ Emacs
Stars: ✭ 4,503 (+714.29%)
Mutual labels:  emacs
Magit
It's Magit! A Git porcelain inside Emacs.
Stars: ✭ 5,406 (+877.58%)
Mutual labels:  emacs
Spacemacs Private
My Spacemacs config
Stars: ✭ 480 (-13.2%)
Mutual labels:  emacs
Deft
Deft for Emacs
Stars: ✭ 521 (-5.79%)
Mutual labels:  emacs
Olivetti
Emacs minor mode for a nice writing environment
Stars: ✭ 554 (+0.18%)
Mutual labels:  emacs
Emacs Elisp Programming
Tutorial about programming Elisp and Emacs text editor customization.
Stars: ✭ 548 (-0.9%)
Mutual labels:  emacs
Dotfiles
Let's be honest: mostly Emacs.
Stars: ✭ 536 (-3.07%)
Mutual labels:  emacs

About

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-mode provides similar functionality in Dired.
  • diff-hl-margin-mode changes the highlighting function to use the margin instead of the fringe.
  • diff-hl-amend-mode sets the reference revision to the one before recent one. Also, you could use diff-hl-set-reference-rev to set it to any revision, see its docstring for details.
  • diff-hl-flydiff-mode implements highlighting changes on the fly.
  • diff-hl-show-hunk-mouse-mode makes fringe and margin react to mouse clicks to show the curresponding hunk. That's the alternative to using diff-hl-show-hunk and friends.

Usage

Put this into your init script:

(global-diff-hl-mode)

Check out the Commentary section in each file for more detailed usage instructions.

Screenshots

diff-hl-mode

Top window: a buffer in this minor mode, bottom window: the corresponding diff.

screenie

diff-hl-dired-mode

screenie

diff-hl-margin-mode

screenie

Requirements

Emacs 25.1+.

Notes

  • By default diff-hl-mode uses the corresponding VC diff command, so it's only accurate when the buffer is in saved state. Check out diff-hl-flydiff-mode, it aims to handle unsaved buffers as well.

  • To use an alternative diff algorithm with Git, add a corresponding argument to vc-git-diff-switches, e.g. (setq vc-git-diff-switches '("--histogram")). Using the diff.algorithm option doesn't work because vc-git-diff calls git diff-index. diff-hl-flydiff-mode does not support alternative algorithms, because it uses the external diff program.

  • 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 diff-hl-margin-mode on, to show the indicators in the margin instead.

  • Frame-local and buffer-local values of line-spacing are not supported.

  • Fringe width up to 16 works best (because we can't define a bitmap with width above that number).

  • 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.

Integration

If you're using some package other than vc to commit changes, it might not run vc-checkin-hook after commits. In that case, you'll need to either add diff-hl-update to the hook it does run, or advise some function that's called in the buffer after its state has changed.

psvn

(advice-add 'svn-status-update-modeline :after #'diff-hl-update)

Magit

If you're using a version before 2.4.0, it defines magit-revert-buffer-hook (or magit-not-reverted-hook), which we use.

When using Magit 2.4 or newer, add this to your init script:

(add-hook 'magit-pre-refresh-hook 'diff-hl-magit-pre-refresh)
(add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].