fix(format): handle git-gutter nicely
This commit is contained in:
parent
7e15504163
commit
dc3b5c3710
2 changed files with 18 additions and 11 deletions
|
@ -42,8 +42,7 @@ select buffers.")
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(font-lock-fontify-region web-mode-scan-beg web-mode-scan-end)))))
|
(font-lock-fontify-region web-mode-scan-beg web-mode-scan-end)))))
|
||||||
(defun +format--refresh-git-gutter-h ()
|
(defun +format--refresh-git-gutter-h ()
|
||||||
(when (bound-and-true-p git-gutter-mode)
|
(+vc-gutter-init-maybe-h)))
|
||||||
(git-gutter))))
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -116,6 +116,11 @@ is deferred until the file is saved. Respects `git-gutter:disabled-modes'."
|
||||||
;; UX: update git-gutter on focus (in case I was using git externally)
|
;; UX: update git-gutter on focus (in case I was using git externally)
|
||||||
(add-hook 'focus-in-hook #'git-gutter:update-all-windows)
|
(add-hook 'focus-in-hook #'git-gutter:update-all-windows)
|
||||||
|
|
||||||
|
;; Stop git-gutter doing things when we don't want
|
||||||
|
(remove-hook 'post-command-hook #'git-gutter:post-command-hook)
|
||||||
|
(advice-remove #'quit-window #'git-gutter:quit-window)
|
||||||
|
(advice-remove #'switch-to-buffer #'git-gutter:switch-to-buffer)
|
||||||
|
|
||||||
(add-hook! '(doom-escape-hook doom-switch-window-hook) :append
|
(add-hook! '(doom-escape-hook doom-switch-window-hook) :append
|
||||||
(defun +vc-gutter-update-h (&rest _)
|
(defun +vc-gutter-update-h (&rest _)
|
||||||
"Refresh git-gutter on ESC. Return nil to prevent shadowing other
|
"Refresh git-gutter on ESC. Return nil to prevent shadowing other
|
||||||
|
@ -130,6 +135,9 @@ is deferred until the file is saved. Respects `git-gutter:disabled-modes'."
|
||||||
(advice-add #'magit-stage-file :after #'+vc-gutter-update-h)
|
(advice-add #'magit-stage-file :after #'+vc-gutter-update-h)
|
||||||
(advice-add #'magit-unstage-file :after #'+vc-gutter-update-h)
|
(advice-add #'magit-unstage-file :after #'+vc-gutter-update-h)
|
||||||
|
|
||||||
|
;; UX: update git-gutter after reverting a buffer
|
||||||
|
(add-hook 'after-revert-hook #'+vc-gutter-update-h)
|
||||||
|
|
||||||
;; FIX: stop git-gutter:{next,previous}-hunk from jumping to random hunks.
|
;; FIX: stop git-gutter:{next,previous}-hunk from jumping to random hunks.
|
||||||
(defadvice! +vc-gutter--fix-linearity-of-hunks-a (diffinfos is-reverse)
|
(defadvice! +vc-gutter--fix-linearity-of-hunks-a (diffinfos is-reverse)
|
||||||
:override #'git-gutter:search-near-diff-index
|
:override #'git-gutter:search-near-diff-index
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue