diff-hl -> git-gutter-fringe
This commit is contained in:
parent
9a9bce7260
commit
ae391a3356
3 changed files with 53 additions and 9 deletions
3
Cask
3
Cask
|
@ -87,7 +87,8 @@
|
|||
(depends-on "neotree")
|
||||
|
||||
;; VCS --- core/core-vcs.el
|
||||
(depends-on "diff-hl")
|
||||
;; (depends-on "diff-hl")
|
||||
(depends-on "git-gutter-fringe")
|
||||
(depends-on "gitconfig-mode")
|
||||
(depends-on "gitignore-mode")
|
||||
(depends-on "github-browse-file")
|
||||
|
|
|
@ -9,16 +9,64 @@
|
|||
"/\\.git/info/exclude$"
|
||||
"/git/ignore$"))
|
||||
|
||||
(use-package github-browse-file
|
||||
:commands (github-browse-file github-browse-file-blame)
|
||||
:init
|
||||
(evil-define-command narf:github-browse-file (&optional bang)
|
||||
(interactive "<!>")
|
||||
(if bang (github-browse-file-blame) (github-browse-file))))
|
||||
|
||||
(use-package git-gutter
|
||||
:commands (git-gutter-mode narf/vcs-next-hunk narf/vcs-prev-hunk
|
||||
narf/vcs-show-hunk narf/vcs-stage-hunk narf/vcs-revert-hunk)
|
||||
:init
|
||||
(add-hook! (text-mode prog-mode) 'git-gutter-mode)
|
||||
:config
|
||||
(require 'git-gutter-fringe)
|
||||
|
||||
(setq git-gutter:update-interval 2)
|
||||
|
||||
(defalias 'narf/vcs-next-hunk 'git-gutter:next-hunk)
|
||||
(defalias 'narf/vcs-prev-hunk 'git-gutter:previous-hunk)
|
||||
(defalias 'narf/vcs-show-hunk 'git-gutter:popup-hunk)
|
||||
(defalias 'narf/vcs-stage-hunk 'git-gutter:stage-hunk)
|
||||
(defalias 'narf/vcs-revert-hunk 'git-gutter:revert-hunk)
|
||||
|
||||
(define-fringe-bitmap 'git-gutter-fr:added
|
||||
[240 240 240 240 240 240 240 240 240 240 240 240 240 240]
|
||||
nil nil 'center)
|
||||
(define-fringe-bitmap 'git-gutter-fr:modified
|
||||
[240 240 240 240 240 240 240 240 240 240 240 240 240 240]
|
||||
nil nil 'center)
|
||||
(define-fringe-bitmap 'git-gutter-fr:deleted
|
||||
[0 0 0 128 192 224 240 248]
|
||||
nil nil 'center)
|
||||
|
||||
(advice-add 'evil-force-normal-state :after 'git-gutter)
|
||||
|
||||
(add-hook! focus-in 'git-gutter:update-all-windows)
|
||||
(add-hook! evil-insert-state-exit 'git-gutter))
|
||||
|
||||
(use-package diff-hl
|
||||
:disabled t
|
||||
:init
|
||||
(setq diff-hl-draw-borders nil
|
||||
diff-hl-fringe-bmp-function 'narf-diff-hl-fringe-bmp)
|
||||
:config
|
||||
(defalias narf/vcs-next-hunk 'diff-hl-next-hunk)
|
||||
(defalias narf/vcs-prev-hunk 'diff-hl-previous-hunk)
|
||||
;; (defalias narf/vcs-show-hunk
|
||||
;; (defalias narf/vcs-stage-hunk ...)
|
||||
(defalias narf/vcs-revert-hunk 'diff-hl-revert-hunk)
|
||||
|
||||
(defun narf-diff-hl-fringe-bmp (type _pos)
|
||||
(if (eq type 'delete)
|
||||
'narf--diff-hl-bitmap-del
|
||||
'narf--diff-hl-bitmap))
|
||||
|
||||
(map! :map diff-mode-shared-map
|
||||
:n "RET" 'diff-goto-source)
|
||||
|
||||
(define-fringe-bitmap 'narf--diff-hl-bitmap
|
||||
[240 240 240 240 240 240 240 240 240 240 240 240 240 240]
|
||||
nil nil 'center)
|
||||
|
@ -28,12 +76,5 @@
|
|||
|
||||
(global-diff-hl-mode 1))
|
||||
|
||||
(use-package github-browse-file
|
||||
:commands (narf:github-browse-file github-browse-file github-browse-file-blame)
|
||||
:config
|
||||
(evil-define-command narf:github-browse-file (&optional bang)
|
||||
(interactive "<!>")
|
||||
(if bang (github-browse-file-blame) (github-browse-file))))
|
||||
|
||||
(provide 'core-vcs)
|
||||
;;; core-vcs.el ends here
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
(exmap "en[ew]" 'narf:file-create)
|
||||
(exmap "full[scr]" 'narf:toggle-fullscreen)
|
||||
(exmap "fullw[rite]" 'narf:toggle-write-mode)
|
||||
(exmap "bl[ame]" 'narf:github-browse-file)
|
||||
(exmap "http" 'httpd-start)
|
||||
(exmap "ini" 'narf:ido-find-file-in-emacsd)
|
||||
(exmap "k[ill]" 'kill-this-buffer) ; Kill current buffer
|
||||
|
@ -54,6 +53,9 @@
|
|||
(exmap "proj[ect]" 'narf:org-crm-project)
|
||||
(exmap "invo[ice]" 'narf:org-crm-invoice)
|
||||
|
||||
;; GIT
|
||||
(exmap "bl[ame]" 'narf:github-browse-file)
|
||||
|
||||
(after! flycheck
|
||||
(exmap "er[rors]" (λ (flycheck-buffer) (flycheck-list-errors))))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue