Created
April 28, 2014 20:12
-
-
Save jordonbiondo/11382720 to your computer and use it in GitHub Desktop.
auto refresh git-gutter when staging and unstaging in magit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defvar my-magit-after-stage-hooks nil) | |
| (defvar my-magit-after-unstage-hooks nil) | |
| (defadvice magit-stage-item (after run-my-after-stage-hooks activate) | |
| (when (called-interactively-p 'interactive) | |
| (run-hooks 'my-magit-after-stage-hooks))) | |
| (defadvice magit-unstage-item (after run-my-after-unstage-hooks activate) | |
| (when (called-interactively-p 'interactive) | |
| (run-hooks 'my-magit-after-unstage-hooks))) | |
| (defun my-refresh-visible-git-gutter-buffers () | |
| (dolist (buff (buffer-list)) | |
| (with-current-buffer buff | |
| (when (and git-gutter-mode (get-buffer-window buff)) | |
| (git-gutter-mode t))))) | |
| (add-hook 'my-magit-after-unstage-hooks | |
| 'my-refresh-visible-git-gutter-buffers) | |
| (add-hook 'my-magit-after-stage-hooks | |
| 'my-refresh-visible-git-gutter-buffers) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment