Skip to content

Instantly share code, notes, and snippets.

@nukosuke
Last active February 13, 2019 05:01
Show Gist options
  • Save nukosuke/a8e8410ac08e48974b8297b404ea3f1c to your computer and use it in GitHub Desktop.
Save nukosuke/a8e8410ac08e48974b8297b404ea3f1c to your computer and use it in GitHub Desktop.
;;
;; magit
;;
(use-package magit
:bind
("C-c C-v" . magit-dispatch-popup))
;;
;; git-gutter
;;
(use-package git-gutter
:custom
(git-gutter:ask-p nil)
:bind
("C-c g" . hydra-git-gutter/body))
(defun git-gutter:toggle-popup-hunk ()
"Toggle git-gutter hunk window."
(interactive)
(if (window-live-p (git-gutter:popup-buffer-window))
(delete-window (git-gutter:popup-buffer-window))
(git-gutter:popup-hunk)))
;;
;; git-gutterのhunk操作用hydra
;;
(defhydra hydra-git-gutter nil
"git hunk"
("p" git-gutter:previous-hunk "previous")
("n" git-gutter:next-hunk "next")
("s" git-gutter:stage-hunk "stage")
("r" git-gutter:revert-hunk "revert")
("m" git-gutter:mark-hunk "mark")
("SPC" git-gutter:toggle-popup-hunk "toggle diffinfo"))
;;
;; git-gutter-fringe
;;
(use-package git-gutter-fringe
:config
(fringe-helper-define 'git-gutter-fr:added '(center repeated)
"XXX.....")
(fringe-helper-define 'git-gutter-fr:modified '(center repeated)
"XXX.....")
(fringe-helper-define 'git-gutter-fr:deleted 'bottom
"X......."
"XX......"
"XXX....."
"XXXX....")
(global-git-gutter-mode t)
:diminish git-gutter-mode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment