emacs : magit

This commit is contained in:
2024-09-04 14:36:13 +09:00
parent a8e4e2a394
commit 16d23ca7da
2 changed files with 47 additions and 32 deletions

View File

@ -94,7 +94,7 @@ Otherwise the startup will be very slow. "
(require 'init-utils)
;; Programming
;;(require 'init-vcs)
(require 'init-vcs)
;;(require 'init-flycheck)
;;(require 'init-eglot)
;;(require 'init-ctags)

View File

@ -5,6 +5,7 @@
;; Git
;; See `magit-maybe-define-global-key-bindings'
(use-package magit
:ensure nil
:commands (magit-status magit-get-current-branch)
:init (setq magit-diff-refine-hunk t)
:config
@ -27,10 +28,12 @@
(bury-buffer buf)
(kill-buffer buf))))
buffers))))
(setq magit-bury-buffer-function #'my-magit-kill-buffers))
(setq magit-bury-buffer-function #'my-magit-kill-buffers)))
;; Show TODOs in magit
(use-package magit-todos
:straight t
:ensure t
:defines magit-todos-nice
:commands magit-todos--scan-with-git-grep
:init
@ -38,14 +41,18 @@
(setq magit-todos-scanner #'magit-todos--scan-with-git-grep)
(setq magit-todos-exclude-globs '(".git/" "*.json" "*.js"))
(let ((inhibit-message t))
(magit-todos-mode 1))))
(magit-todos-mode 1)))
;; Walk through git revisions of a file
(use-package git-timemachine
:straight t
:ensure t
:defer t
:custom-face
(git-timemachine-minibuffer-author-face ((t (:inherit success :foreground unspecified))))
(git-timemachine-minibuffer-detail-face ((t (:inherit warning :foreground unspecified))))
:hook ((git-timemachine-mode . (lambda ()
:hook ((git-timemachine-mode
. (lambda ()
"Improve `git-timemachine' buffers."
;; Display different colors in mode-line
(if (facep 'mode-line-active)
@ -66,7 +73,9 @@
(user-error "Cannot revert the timemachine buffer"))))))
;; Resolve diff3 conflicts
(use-package smerge-mode
:ensure nil
:straight t
:ensure t
:defer t
:diminish
:pretty-hydra
((:title (pretty-hydra-title "Smerge" 'octicon "nf-oct-diff")
@ -108,11 +117,17 @@
(smerge-mode-hydra/body))))))
;; Open github/gitlab/bitbucket page
(use-package browse-at-remote
:straight t
:ensure t
:defer t
:bind (:map vc-prefix-map
("B" . browse-at-remote)))
;; Git configuration modes
(use-package git-modes)
;; Git configuration modes (ex: gitignore gitattributes gitconfig)
(use-package git-modes
:straight t
:ensure t
:defer t)
(provide 'init-vcs)