blob: 5a623ac9050fec440766757a3f29ce6d20010b59 (
plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
;;; ravi-init-vc.el --- vc control
;; Copyright (C) 2013
;; Author: <ravi@nero.lan>
;; Keywords: vc
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Version control initialization
;;; Code:
(use-package vdiff
:commands (vdiff-files
vdiff-files3
vdiff-buffers
vdiff-buffers3
vdiff-current-file
vdiff-merge-conflict))
;; Git
(use-package magit
:bind (("<M-f3>" . magit-status)
("C-c M-g" . magit-file-dispatch))
:config
(progn
(setq-default
magit-process-popup-time 10
magit-diff-refine-hunk t
magit-completing-read-function (if ravi/use-helm-instead-of-ido
'helm--completing-read-default
'magit-ido-completing-read))
(setq magit-restore-window-configuration t)
(add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh)
(defvar ravi/sync-top-level-host-extra-args ""
"Extra arguments to rsync for `ravi/sync-top-level'")
(defun ravi/sync-top-level ()
(when (and (boundp 'ravi/sync-top-level-host)
(not (s-equals? (car (s-split-up-to "\\." (system-name) 1))
(car (s-split-up-to "\\." ravi/sync-top-level-host 1)))))
(message "Synchronizing with %s" ravi/sync-top-level-host)
(shell-command (concat "rsync -a " ravi/sync-top-level-host-extra-args
" " (magit-toplevel) " " ravi/sync-top-level-host ":" (magit-toplevel)))))
(add-hook 'magit-post-refresh-hook 'ravi/sync-top-level)
(global-magit-file-mode 1)
(unbind-key "C-x g" magit-file-mode-map)
(use-package vdiff-magit
:commands (vdiff-magit
vdiff-magit-dwim)
:init
(define-key magit-mode-map "e" 'vdiff-magit-dwim)
(define-key magit-mode-map "E" 'vdiff-magit)
(transient-suffix-put 'magit-dispatch "e" :description "vdiff (dwim)")
(transient-suffix-put 'magit-dispatch "e" :command 'vdiff-magit-dwim)
(transient-suffix-put 'magit-dispatch "E" :description "vdiff")
(transient-suffix-put 'magit-dispatch "E" :command 'vdiff-magit))
(use-package magit-svn
:config (add-hook 'magit-mode-hook 'magit-svn-mode))
)
:ensure t)
(use-package gitignore-mode)
(use-package gitconfig-mode)
(use-package git-messenger
:bind ("C-x v p" . git-messenger:popup-message))
(use-package git-timemachine
:bind ("C-x v t" . git-timemachine))
(use-package vc-git
:bind ("C-x v f" . vc-git-grep)
:ensure nil)
(use-package diff-hl
:config
(global-diff-hl-mode))
;; Stolen almost entirely from Fuco (Matus Goljer)
(use-package ediff
:config
(progn
(defvar my-ediff-before-config nil "Window configuration before ediff.")
(defvar my-ediff-after-config nil "Window configuration after ediff.")
(defun my-ediff-before-setup ()
"Function to be called before any buffers or window setup for
ediff."
(setq my-ediff-before-config (current-window-configuration))
(set-register ?b (list my-ediff-before-config (point-marker))))
(defun my-ediff-after-setup ()
"Function to be called after buffers and window setup for ediff."
(setq my-ediff-after-config (current-window-configuration))
(set-register ?e (list my-ediff-after-config (point-marker))))
(defun my-ediff-quit ()
"Function to be called when ediff quits."
(when my-ediff-before-config
(set-window-configuration my-ediff-before-config))
;; clean up ediff bullshit
(->> (buffer-list)
(-map 'buffer-name)
(--select (string-match-p "\\*[Ee]diff" it))
(-map 'kill-buffer)))
(add-hook 'ediff-before-setup-hook 'my-ediff-before-setup)
(add-hook 'ediff-after-setup-windows-hook 'my-ediff-after-setup 'append)
(add-hook 'ediff-quit-hook 'my-ediff-quit)))
(provide 'ravi-init-vc)
;;; ravi-init-vc.el ends here
|