-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathvc-config.el
More file actions
59 lines (48 loc) · 1.84 KB
/
vc-config.el
File metadata and controls
59 lines (48 loc) · 1.84 KB
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
;;; vc-config.el --- Version control configuration
;;; Commentary:
;;; Code:
;; ;; light weight additions and remapping to vc-git (ELPA)
;; (load-library "gitty")
;; auto-revert-mode for files under version control
(add-hook 'find-file-hook
(lambda ()
(condition-case nil
(if (vc-working-revision (buffer-file-name))
(auto-revert-mode t))
(error nil))))
;; mode to edit git commit message, load after `orgalist'
(autoload 'git-commit-mode "git-commit"
"Major mode for editing git commit messages." t)
(add-hook 'git-commit-mode-hook (lambda () (orgalist-mode t)))
(require 'magit)
(defun sa-magit-log (files &optional long)
"My Magit log function.
FILES are passed on as is, when LONG show a more verbose git log."
(interactive "P")
(magit-log-current
nil (if (not long) '("--graph")
'("--graph" "--format=medium" "--stat"))
files))
(define-key magit-log-mode-map (kbd "TAB") 'magit-goto-next-section)
(define-key magit-log-mode-map (kbd "<backtab>") 'magit-goto-previous-section)
(global-set-key (kbd "C-x v s") 'magit-status)
(global-set-key (kbd "C-x v d") 'magit-diff-unstaged)
(global-set-key (kbd "C-x v D") 'magit-diff-staged)
(global-set-key (kbd "C-x v l")
(lambda (&optional long)
(interactive "P")
(sa-magit-log nil long)))
(global-set-key (kbd "C-x v L")
(lambda (&optional long)
(interactive "P")
(sa-magit-log (list (buffer-file-name)) long)))
;; A better binding might be
;; - file log: l - short, L - long (don't know how to get this)
;; - with prefix, repo log: same
;; (require 'magit-filenotify)
;; (add-hook 'magit-status-mode-hook 'magit-filenotify-mode)
(require 'magit-blame)
;;; vc-config.el ends here
;; Local Variables:
;; flycheck-disabled-checkers: (emacs-lisp emacs-lisp-checkdoc)
;; End: