This is not melpa version. This is my own git-gutter.el implementation. I'm tired from maintaining emacs package.
git-gutter2.el
is port of GitGutter
which is a plugin of Sublime Text.
- Asynchronous updating
- Work without
vc-mode
- Git(1.7.0 or higher)
git-gutter2.el
provides global minor-mode(global-git-gutter2-mode
) and minor-mode(git-gutter2-mode
).
If you want to use git-gutter2
for files in git repository.
You add following s-exp in your configuration file(~/.emacs.d/init.el
).
(global-git-gutter2-mode +1)
Other case, you want to use git-gutter2
for some files, you can use git-gutter2-mode
.
Following example of enabling git-gutter2
for some mode.
(add-hook 'ruby-mode-hook 'git-gutter2-mode)
(add-hook 'python-mode-hook 'git-gutter2-mode)
git-gutter2.el
provides following commands.
Obsoleted interfaces will be removed when 1.0 released.
Jump to next hunk
Jump to previous hunk
Popup current diff hunk(alias git-gutter2-popup-diff
)
git-gutter2-next-hunk
and git-gutter2-previous-hunk
update content
of buffer popuped by git-gutter2-popup-diff
to current hunk.
Revert current hunk
Show/update changes from last commit or Update change information. Please execute this command if diff information is not be updated.
(require 'git-gutter2)
;; If you enable global minor mode
(global-git-gutter2-mode t)
;; If you enable git-gutter2-mode for some modes
(add-hook 'ruby-mode-hook 'git-gutter2-mode)
(global-set-key (kbd "C-x C-g") 'git-gutter2-update)
(global-set-key (kbd "C-x v =") 'git-gutter2-popup-hunk)
;; Jump to next/previous hunk
(global-set-key (kbd "C-x p") 'git-gutter2-previous-hunk)
(global-set-key (kbd "C-x n") 'git-gutter2-next-hunk)
;; Revert current hunk
(global-set-key (kbd "C-x v r") 'git-gutter2-revert-hunk)
You can change the signs and those faces.
(custom-set-variables
'(git-gutter2-modified-sign " ") ;; two space
'(git-gutter2-added-sign "++") ;; multiple character is OK
'(git-gutter2-deleted-sign "--"))
(set-face-background 'git-gutter2-modified "purple") ;; background color
(set-face-foreground 'git-gutter2-added "green")
(set-face-foreground 'git-gutter2-deleted "red")
diff information is updated at hooks in git-gutter2-update-hooks
.
(add-to-list 'git-gutter2-update-hooks 'focus-in-hook)
diff information is updated after command in git-gutter2-update-commands
executed.
(add-to-list 'git-gutter2-update-commands 'other-window)
Run hook git-gutter2-mode-on-hook
when git-gutter2-mode
is turn on, and
run hook git-gutter2-mode-off-hook
when git-gutter2-mode
is turn off.
Count unstaged hunks in current buffer.