forked from 11111000000/pen.el
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pen-git.el
70 lines (54 loc) · 1.89 KB
/
pen-git.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
61
62
63
64
65
66
67
68
69
70
(setq vc-follow-symlinks t)
(defun git-get-top-fast ()
(locate-dominating-file default-directory ".git"))
(defun sh/git-get-commit-message ()
(chomp (pen-sn "git get-commit-message")))
(defun sh/git-amend-all-below ()
"Show git amend in tmux."
(interactive)
(let ((mess (sh/git-get-commit-message)))
(save-buffer)
(pen-sn (concat "git add -A .; git amend"))
(revert-buffer nil t)
(message (concat "Amended -A . with original message " (pen-q mess)))))
(defun sh/git-add-all-below ()
(interactive)
(let ((mess (chomp (vime "strftime(\"%c\")"))))
(if (buffer-file-name)
(save-buffer))
(pen-sn (concat "git add -A .; git commit -m " (pen-q mess)))
(save-excursion
(if (buffer-file-name)
(save-buffer)))
(message (concat "Committed -A . with message " (pen-q mess)))))
(defun sh/git-get-url ()
(pen-sn "git config --get remote.origin.url"))
(use-package gitattributes-mode :defer t)
(defun gitattributes-whitespace-apply-around-advice (proc &rest args)
(let ((res (ignore-errors (apply proc args))))
res))
(advice-add 'gitattributes-whitespace-apply :around #'gitattributes-whitespace-apply-around-advice)
(use-package gitconfig-mode :defer t)
(use-package gitignore-mode :defer t)
(use-package github-pullrequest)
(defun git-d-unstaged (&optional path)
(interactive)
(if (not path)
(setq path (get-path)))
(pen-sph (concat "git d " (pen-q path))))
(defalias 'get-top-level 'projectile-project-root)
(defun pen-cd (dir)
(cond
((derived-mode-p 'ranger-mode) (ranger dir))
((derived-mode-p 'dired-mode) (dired dir))
(t (cd dir)))
(message (pen-mnm (concat "cd " (pen-q dir)))))
(defun pen-vc-cd-top-level ()
(interactive)
(pen-cd (get-top-level)))
(defun cd-vc-cd-top-level ()
(interactive)
(dired (get-top-level)))
(require 'git-gutter+)
(advice-add 'git-gutter+-diff :around #'advise-to-shut-up)
(provide 'pen-git)