-
Notifications
You must be signed in to change notification settings - Fork 4
/
init-magit.el
60 lines (51 loc) · 2.13 KB
/
init-magit.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
(setq magit-last-seen-setup-instructions "1.4.0")
;; avoid conflicts with vc:
;; (remove-hook 'find-file-hooks 'vc-find-file-hook)
(setq magit-diff-refine-hunk 'all)
(setq git-rebase-auto-advance t)
(setq magit-stage-all-confirm nil)
(setq magit-commit-squash-commit 'marked-or-current)
(setq magit-push-always-verify nil) ; cuz it says so
(defun m/magit-display-buffer-traditional (buffer)
"Like magit-display-buffer-traditional, but re-uses window for status mode, too."
(display-buffer
buffer (if (not (memq (with-current-buffer buffer major-mode)
'(magit-process-mode
magit-revision-mode
magit-diff-mode
magit-stash-mode)))
'(display-buffer-same-window)
nil)))
(setq magit-display-buffer-function 'm/magit-display-buffer-traditional)
(setq magit-log-section-commit-count' 10)
(setq magit-log-section-arguments '("--graph" "--decorate" "--color"))
(setq magit-status-sections-hook
'(magit-insert-status-headers
magit-insert-merge-log
magit-insert-rebase-sequence
magit-insert-am-sequence
magit-insert-sequencer-sequence
magit-insert-bisect-output
magit-insert-bisect-rest
magit-insert-bisect-log
magit-insert-untracked-files
magit-insert-unstaged-changes
magit-insert-staged-changes
magit-insert-unpushed-cherries
magit-insert-recent-commits
magit-insert-unpulled-from-pushremote
magit-insert-unpushed-to-upstream
magit-insert-unpushed-to-pushremote
magit-insert-unpulled-from-upstream
magit-insert-stashes))
(font-lock-add-keywords 'emacs-lisp-mode
magit-font-lock-keywords)
(defun m/magit-reset-author (&optional args)
"Resets the authorship information for the last commit"
(interactive)
(magit-run-git-async "commit" "--amend" "--no-edit" "--reset-author"))
;; (magit-define-popup-action 'magit-commit-popup
;; ?R "Reset author" 'm/magit-reset-author)
(transient-append-suffix 'magit-commit
"S"
'("R" "Reset author" m/magit-reset-author))