Skip to content

Commit

Permalink
speed up magit
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen Bin committed Nov 30, 2020
1 parent 9294cec commit 21d5fcc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions lisp/init-git.el
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

;; ;; {{ Solution 1: disable all vc backends
;; @see http://stackoverflow.com/questions/5748814/how-does-one-disable-vc-git-in-emacs
;; (setq vc-handled-backends ())
;; (setq vc-handled-backends nil)
;; }}

;; {{ Solution 2: if NO network mounted drive involved
Expand Down Expand Up @@ -46,7 +46,7 @@
markdown-mode
image-mode)))

(defun git-gutter-reset-to-head-parent()
(defun my-git-gutter-reset-to-head-parent()
"Reset gutter to HEAD^. Support Subversion and Git."
(interactive)
(let* ((filename (buffer-file-name))
Expand All @@ -62,6 +62,18 @@
(git-gutter:set-start-revision parent)
(message "git-gutter:set-start-revision HEAD^")))

;; {{ speed up magit, @see https://jakemccrary.com/blog/2020/11/14/speeding-up-magit/
(defvar my-prefer-lightweight-magit t)
(with-eval-after-load 'magit
(when my-prefer-lightweight-magit
(remove-hook 'magit-status-sections-hook 'magit-insert-tags-header)
(remove-hook 'magit-status-sections-hook 'magit-insert-status-headers)
(remove-hook 'magit-status-sections-hook 'magit-insert-unpushed-to-pushremote)
(remove-hook 'magit-status-sections-hook 'magit-insert-unpulled-from-pushremote)
(remove-hook 'magit-status-sections-hook 'magit-insert-unpulled-from-upstream)
(remove-hook 'magit-status-sections-hook 'magit-insert-unpushed-to-upstream-or-recent)))
;; }}

(defun git-gutter-toggle ()
"Toggle git gutter."
(interactive)
Expand Down
2 changes: 1 addition & 1 deletion lisp/init-hydra.el
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ Git:
"
("ri" my-git-rebase-interactive)
("rr" git-gutter-reset-to-default)
("rh" git-gutter-reset-to-head-parent)
("rh" my-git-gutter-reset-to-head-parent)
("s" my-git-show-commit)
("l" magit-log-buffer-file)
("b" magit-show-refs-popup)
Expand Down

0 comments on commit 21d5fcc

Please sign in to comment.