bash: Disallow overwriting existing file using shell redirection
[~bandali/configs] / .emacs.d / lisp / bandali-magit.el
... / ...
CommitLineData
1;;; bandali-magit.el --- bandali's magit configuration -*- lexical-binding: t; -*-
2
3;; Copyright (C) 2018-2020 Amin Bandali
4
5;; Author: Amin Bandali <bandali@gnu.org>
6;; Keywords: vc
7
8;; This program is free software; you can redistribute it and/or modify
9;; it under the terms of the GNU General Public License as published by
10;; the Free Software Foundation, either version 3 of the License, or
11;; (at your option) any later version.
12
13;; This program is distributed in the hope that it will be useful,
14;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;; GNU General Public License for more details.
17
18;; You should have received a copy of the GNU General Public License
19;; along with this program. If not, see <https://www.gnu.org/licenses/>.
20
21;;; Commentary:
22
23;; It's Magit!
24
25;;; Code:
26
27(csetq transient-history-file (b/var "transient/history.el")
28 transient-levels-file (b/etc "transient/levels.el")
29 transient-values-file (b/etc "transient/values.el"))
30(with-eval-after-load 'magit
31 (declare-function magit-add-section-hook "magit-section"
32 (hook function &optional at append local))
33 (magit-add-section-hook 'magit-status-sections-hook
34 'magit-insert-modules
35 'magit-insert-stashes
36 'append)
37 ;; (magit-add-section-hook 'magit-status-sections-hook
38 ;; 'magit-insert-ignored-files
39 ;; 'magit-insert-untracked-files
40 ;; 'append)
41 (declare-function magit-display-buffer-fullframe-status-v1
42 "magit-mode" (buffer))
43 (csetq
44 magit-diff-refine-hunk t
45 magit-repository-directories '(("~/.emacs.d/" . 0)
46 ("~/src/git/" . 2))
47 ;; magit-completing-read-function 'magit-ido-completing-read
48 magit-display-buffer-function
49 #'magit-display-buffer-fullframe-status-v1)
50 (nconc magit-section-initial-visibility-alist
51 '(([unpulled status] . show)
52 ([unpushed status] . show)))
53 (custom-set-faces '(magit-diff-file-heading ((t (:weight normal)))))
54
55 (with-eval-after-load 'magit-extras
56 (csetq
57 magit-pop-revision-stack-format
58 (pcase-let ((`(,pt ,_eob ,index-regexp)
59 (default-value 'magit-pop-revision-stack-format)))
60 `(,pt "[%N: %h]: %ci\n %s
61 https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=%H"
62 ,index-regexp)))))
63;; global key bindings
64(global-set-key (kbd "C-x g") #'magit-status)
65(global-set-key (kbd "C-c g b") #'magit-blame-addition)
66(global-set-key (kbd "C-c g l") #'magit-log-buffer-file)
67(global-set-key (kbd "C-c g y") #'magit-pop-revision-stack)
68
69(provide 'bandali-magit)
70;;; bandali-magit.el ends here