2015-01-14 04:12:56 +00:00
|
|
|
;;; packages.el --- Git Layer packages File for Spacemacs
|
|
|
|
;;
|
2020-09-16 21:34:40 +00:00
|
|
|
;; Copyright (c) 2012-2020 Sylvain Benner & Contributors
|
2015-01-14 04:12:56 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2015-04-19 03:40:24 +00:00
|
|
|
(setq git-packages
|
2015-06-09 15:43:14 +00:00
|
|
|
'(
|
2015-11-06 23:24:51 +00:00
|
|
|
evil-magit
|
2016-10-02 13:20:34 +00:00
|
|
|
fill-column-indicator
|
2020-11-14 16:53:33 +00:00
|
|
|
;; forge requires a C compiler on Windows so we disable
|
|
|
|
;; it by default on Windows.
|
|
|
|
(forge :toggle (not (spacemacs/system-is-mswindows)))
|
2015-06-09 15:43:14 +00:00
|
|
|
gitattributes-mode
|
|
|
|
gitconfig-mode
|
|
|
|
gitignore-mode
|
2018-06-15 20:36:48 +00:00
|
|
|
gitignore-templates
|
2015-07-09 22:52:18 +00:00
|
|
|
git-commit
|
2016-07-05 03:00:11 +00:00
|
|
|
git-link
|
2015-06-09 15:43:14 +00:00
|
|
|
git-messenger
|
|
|
|
git-timemachine
|
2019-03-10 17:39:36 +00:00
|
|
|
golden-ratio
|
2018-03-27 01:19:04 +00:00
|
|
|
(helm-git-grep :requires helm)
|
2017-07-03 07:52:54 +00:00
|
|
|
(helm-gitignore :requires helm)
|
2015-07-02 04:36:26 +00:00
|
|
|
magit
|
2020-09-21 13:08:06 +00:00
|
|
|
(magit-delta :toggle git-enable-magit-delta-plugin)
|
2019-02-18 17:56:45 +00:00
|
|
|
magit-gitflow
|
2020-01-23 22:53:38 +00:00
|
|
|
magit-section
|
2018-04-22 15:49:51 +00:00
|
|
|
magit-svn
|
2019-09-20 16:16:22 +00:00
|
|
|
org
|
2017-07-03 07:52:54 +00:00
|
|
|
(orgit :requires org)
|
2015-07-02 04:36:26 +00:00
|
|
|
smeargle
|
2020-03-27 19:40:15 +00:00
|
|
|
transient))
|
|
|
|
|
2015-06-24 03:52:24 +00:00
|
|
|
|
2019-03-10 17:39:36 +00:00
|
|
|
(defun git/pre-init-golden-ratio ()
|
|
|
|
(spacemacs|use-package-add-hook golden-ratio
|
|
|
|
:post-config
|
|
|
|
(add-to-list 'golden-ratio-exclude-buffer-names " *transient*")))
|
|
|
|
|
2018-01-11 04:31:57 +00:00
|
|
|
(defun git/pre-init-evil-magit ()
|
2018-01-09 09:48:57 +00:00
|
|
|
(spacemacs|use-package-add-hook magit
|
|
|
|
:post-config
|
|
|
|
(when (spacemacs//support-evilified-buffer-p dotspacemacs-editing-style)
|
|
|
|
(evil-magit-init))
|
Use evil in holy-mode
Motivation
While disabling Evil in holy-mode makes its implementation shorter and
sounds elegant on the paper, in practice it puts a big burden on the
configuration parts which need to know if Evil is enable or not. This is
a bad separation of concerns and the bunch of fixes that we were forced
to do in the past weeks shows this issue. Those fixes were about
removing the knowledge of the activation of Evil by implementing new
dispatching functions to be used by layers, this is cumbersome and makes
Spacemacs layer configuration more subtle which is not good. There was
additional bad consequences of the removal of Evil state like the
impossibility to use Evil lisp state or iedit states, or we would have
been forced to implement a temporary activation of Evil which is
awkward.
Instead I reintroduce Evil as the central piece of Spacemacs design thus
Evil is now re-enabled in holy-mode. It provides the abstraction we need
to isolate editing styles and be able to grow the Spacemacs
configuration coverage sanely. Layers don't need to check whether the
holy mode is active or not and they don't need to know if Evil is
available (it is always available). We also don't need to write
additional dispatching functions, this is the job of Evil, and I think
it provides everything for this. Ideally configuration layer should be
implemented with only Evil in mind and the holy-mode (and hybrid-mode)
should magically make it work for Emacs style users, for instance we can
freely use `evil-insert-state` anywhere in the code without any guard.
Evil is now even more part of Spacemacs, we can really say that
Spacemacs is Emacs+Evil which is now an indivisible pair. Spacemacs
needed this stable API to continue on the right track.
While these changes should be rather transparent to the user, I'm sorry
for this experimental period, I failed to see all the implications of
such a change, I was just excited about the possibility to make Evil
optional. The reality is that Spacemacs has to embrace it and keep its
strong position on being Emacs+Evil at the core.
Implementation
- insert, motion and normal states are forced to emacs state using an
advice on `evil-insert-state`, `evil-motion-state` and
`evil-normal-state` respectively. These functions can be used freely in
the layer configuration.
- A new general hook `spacemacs-editing-style-hook` allow to hook any
code that need to be configured based on the editing style. Functions
hooked to this hook takes the current style as parameter, this
basically generalize the hook used to setup hjkl navigation bindings.
- ESC has been removed from the emacs state map.
- Revert unneeded changes
- Revert "evil: enter insert-state only from normal-state"
commit bdd702dfbe302206bbc989c7a0832daba087a781.
- Revert "avoid being evil in deft with emacs editing style"
commit f3a16f49ed27cc8cf05f23f93b006d6e04235381.
Additional changes
All editing style packages have been moved to a layer called
`spacemacs-editing-styles`
Notes
I did not have time to attack hybrid mode, I should be able to do it
later.
2016-03-13 23:41:18 +00:00
|
|
|
(evil-define-key 'motion magit-mode-map
|
2020-11-28 07:40:59 +00:00
|
|
|
(kbd dotspacemacs-leader-key) spacemacs-default-map)
|
|
|
|
;; Remove inherited bindings from evil-mc and evil-easymotion
|
|
|
|
;; do this after the config to make sure the keymap is available
|
|
|
|
(which-key-add-keymap-based-replacements magit-mode-map
|
|
|
|
"<normal-state> g r" nil
|
|
|
|
"<visual-state> g r" nil
|
|
|
|
"<normal-state> g s" nil
|
|
|
|
"<visual-state> g s" nil)))
|
2018-01-11 04:31:57 +00:00
|
|
|
|
|
|
|
(defun git/init-evil-magit ()
|
|
|
|
(use-package evil-magit
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2018-01-11 04:31:57 +00:00
|
|
|
:init (add-hook 'spacemacs-editing-style-hook
|
|
|
|
'spacemacs//magit-evil-magit-bindings)))
|
2015-10-28 13:13:11 +00:00
|
|
|
|
2016-10-02 13:20:34 +00:00
|
|
|
(defun git/post-init-fill-column-indicator ()
|
|
|
|
(add-hook 'git-commit-mode-hook 'fci-mode))
|
|
|
|
|
2018-03-27 01:19:04 +00:00
|
|
|
(defun git/init-helm-git-grep ()
|
|
|
|
(use-package helm-git-grep
|
|
|
|
:defer t
|
|
|
|
:init (spacemacs/set-leader-keys
|
|
|
|
"g/" 'helm-git-grep
|
|
|
|
"g*" 'helm-git-grep-at-point)))
|
|
|
|
|
2016-05-30 02:39:21 +00:00
|
|
|
(defun git/init-helm-gitignore ()
|
|
|
|
(use-package helm-gitignore
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2016-05-30 02:39:21 +00:00
|
|
|
:init (spacemacs/set-leader-keys "gI" 'helm-gitignore)))
|
2015-05-18 02:43:42 +00:00
|
|
|
|
2015-07-09 22:52:18 +00:00
|
|
|
(defun git/init-git-commit ()
|
2015-07-26 05:03:30 +00:00
|
|
|
(use-package git-commit
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t))
|
2015-07-09 22:52:18 +00:00
|
|
|
|
2016-07-05 03:00:11 +00:00
|
|
|
(defun git/init-git-link ()
|
|
|
|
(use-package git-link
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2016-07-05 03:00:11 +00:00
|
|
|
:init
|
|
|
|
(progn
|
2016-07-05 03:17:14 +00:00
|
|
|
(spacemacs/declare-prefix "gl" "links")
|
2016-07-05 03:00:11 +00:00
|
|
|
(spacemacs/set-leader-keys
|
2019-08-15 16:57:05 +00:00
|
|
|
"glc" 'git-link-commit
|
|
|
|
"glC" 'spacemacs/git-link-commit-copy-url-only
|
|
|
|
"gll" 'git-link
|
2016-07-05 03:00:11 +00:00
|
|
|
"glL" 'spacemacs/git-link-copy-url-only
|
2019-10-01 14:04:30 +00:00
|
|
|
"glp" 'spacemacs/git-permalink
|
2019-08-15 16:57:05 +00:00
|
|
|
"glP" 'spacemacs/git-permalink-copy-url-only)
|
2019-10-01 14:04:30 +00:00
|
|
|
|
2016-07-05 03:00:11 +00:00
|
|
|
;; default is to open the generated link
|
|
|
|
(setq git-link-open-in-browser t))))
|
|
|
|
|
2014-12-14 04:59:02 +00:00
|
|
|
(defun git/init-git-messenger ()
|
|
|
|
(use-package git-messenger
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2016-07-05 02:35:05 +00:00
|
|
|
:init (spacemacs/set-leader-keys "gM" 'git-messenger:popup-message)
|
|
|
|
:config (define-key git-messenger-map [escape] 'git-messenger:popup-close)))
|
2014-12-14 04:59:02 +00:00
|
|
|
|
|
|
|
(defun git/init-git-timemachine ()
|
|
|
|
(use-package git-timemachine
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2016-01-20 02:55:38 +00:00
|
|
|
:commands spacemacs/time-machine-transient-state/body
|
2014-12-14 04:59:02 +00:00
|
|
|
:init
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys
|
2016-01-20 02:55:38 +00:00
|
|
|
"gt" 'spacemacs/time-machine-transient-state/body)
|
2015-02-22 05:05:20 +00:00
|
|
|
:config
|
|
|
|
(progn
|
2016-01-20 02:55:38 +00:00
|
|
|
(spacemacs|define-transient-state time-machine
|
|
|
|
:title "Git Timemachine Transient State"
|
2016-01-14 21:19:13 +00:00
|
|
|
:doc "
|
2016-03-11 11:03:10 +00:00
|
|
|
[_p_/_N_] previous [_n_] next [_c_] current [_g_] goto nth rev [_Y_] copy hash [_q_] quit"
|
2015-10-20 01:21:31 +00:00
|
|
|
:on-enter (let (golden-ratio-mode)
|
|
|
|
(unless (bound-and-true-p git-timemachine-mode)
|
|
|
|
(call-interactively 'git-timemachine)))
|
|
|
|
:on-exit (when (bound-and-true-p git-timemachine-mode)
|
|
|
|
(git-timemachine-quit))
|
2016-01-14 21:19:13 +00:00
|
|
|
:foreign-keys run
|
2015-02-22 05:05:20 +00:00
|
|
|
:bindings
|
|
|
|
("c" git-timemachine-show-current-revision)
|
2016-03-11 11:03:10 +00:00
|
|
|
("g" git-timemachine-show-nth-revision)
|
2015-02-22 05:05:20 +00:00
|
|
|
("p" git-timemachine-show-previous-revision)
|
|
|
|
("n" git-timemachine-show-next-revision)
|
2015-02-22 06:46:36 +00:00
|
|
|
("N" git-timemachine-show-previous-revision)
|
2015-03-03 09:01:05 +00:00
|
|
|
("Y" git-timemachine-kill-revision)
|
2015-02-22 06:46:36 +00:00
|
|
|
("q" nil :exit t)))))
|
2014-12-14 04:59:02 +00:00
|
|
|
|
2015-03-26 16:10:54 +00:00
|
|
|
(defun git/init-gitattributes-mode ()
|
|
|
|
(use-package gitattributes-mode
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t))
|
2015-03-26 16:10:54 +00:00
|
|
|
|
2015-03-28 03:51:08 +00:00
|
|
|
(defun git/init-gitconfig-mode ()
|
|
|
|
(use-package gitconfig-mode
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t))
|
2015-03-28 03:51:08 +00:00
|
|
|
|
2015-03-26 16:10:54 +00:00
|
|
|
(defun git/init-gitignore-mode ()
|
|
|
|
(use-package gitignore-mode
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t))
|
2015-03-26 16:10:54 +00:00
|
|
|
|
2018-06-15 20:36:48 +00:00
|
|
|
(defun git/init-gitignore-templates ()
|
|
|
|
(use-package gitignore-templates
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'gitignore-mode
|
|
|
|
"i" 'gitignore-templates-insert)
|
|
|
|
(spacemacs/set-leader-keys
|
|
|
|
"gfi" 'gitignore-templates-new-file)))
|
|
|
|
|
2014-12-14 04:59:02 +00:00
|
|
|
(defun git/init-magit ()
|
|
|
|
(use-package magit
|
2018-03-31 04:55:59 +00:00
|
|
|
:defer (spacemacs/defer)
|
2014-12-14 04:59:02 +00:00
|
|
|
:init
|
2015-03-23 03:11:00 +00:00
|
|
|
(progn
|
2018-10-25 12:59:11 +00:00
|
|
|
(push "magit: .*" spacemacs-useless-buffers-regexp)
|
|
|
|
(push "magit-.*: .*" spacemacs-useless-buffers-regexp)
|
2020-09-20 21:56:32 +00:00
|
|
|
(spacemacs|require-when-dumping 'magit)
|
2016-01-04 19:35:19 +00:00
|
|
|
(setq magit-completing-read-function
|
2017-07-02 13:48:06 +00:00
|
|
|
(if (configuration-layer/layer-used-p 'ivy)
|
2016-01-04 19:35:19 +00:00
|
|
|
'ivy-completing-read
|
|
|
|
'magit-builtin-completing-read))
|
|
|
|
(setq magit-revision-show-gravatars '("^Author: " . "^Commit: "))
|
2015-04-04 10:36:50 +00:00
|
|
|
;; On Windows, we must use Git GUI to enter username and password
|
|
|
|
;; See: https://github.com/magit/magit/wiki/FAQ#windows-cannot-push-via-https
|
2015-04-11 17:22:37 +00:00
|
|
|
(when (eq window-system 'w32)
|
|
|
|
(setenv "GIT_ASKPASS" "git-gui--askpass"))
|
2016-07-05 02:35:05 +00:00
|
|
|
;; key bindings
|
2016-07-29 03:21:36 +00:00
|
|
|
(spacemacs/declare-prefix "gf" "file")
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys
|
2020-06-04 21:50:03 +00:00
|
|
|
"gb" 'spacemacs/git-blame-transient-state/body
|
2016-12-09 02:16:39 +00:00
|
|
|
"gc" 'magit-clone
|
2019-10-05 06:17:54 +00:00
|
|
|
"gfF" 'magit-find-file
|
2018-01-29 18:59:20 +00:00
|
|
|
"gfl" 'magit-log-buffer-file
|
2019-02-16 15:17:27 +00:00
|
|
|
"gfd" 'magit-diff
|
2016-12-09 02:16:39 +00:00
|
|
|
"gi" 'magit-init
|
2016-09-12 14:54:26 +00:00
|
|
|
"gL" 'magit-list-repositories
|
2019-02-15 17:31:01 +00:00
|
|
|
"gm" 'magit-dispatch
|
2016-07-29 03:21:36 +00:00
|
|
|
"gs" 'magit-status
|
|
|
|
"gS" 'magit-stage-file
|
|
|
|
"gU" 'magit-unstage-file)
|
2020-06-04 21:50:03 +00:00
|
|
|
(spacemacs|define-transient-state git-blame
|
2016-01-20 02:55:38 +00:00
|
|
|
:title "Git Blame Transient State"
|
2020-06-04 21:50:03 +00:00
|
|
|
:hint-is-doc t
|
|
|
|
:dynamic-hint (spacemacs//git-blame-ts-hint)
|
2015-10-20 01:10:25 +00:00
|
|
|
:on-enter (let (golden-ratio-mode)
|
|
|
|
(unless (bound-and-true-p magit-blame-mode)
|
2018-10-30 09:23:45 +00:00
|
|
|
(call-interactively 'magit-blame-addition)))
|
2015-10-19 03:36:03 +00:00
|
|
|
:bindings
|
2020-06-04 21:50:03 +00:00
|
|
|
("?" spacemacs//git-blame-ts-toggle-hint)
|
|
|
|
;; chunks
|
|
|
|
("p" magit-blame-previous-chunk)
|
|
|
|
("P" magit-blame-previous-chunk-same-commit)
|
|
|
|
("n" magit-blame-next-chunk)
|
|
|
|
("N" magit-blame-next-chunk-same-commit)
|
|
|
|
("RET" magit-show-commit)
|
|
|
|
;; commits
|
2018-10-30 09:23:45 +00:00
|
|
|
("b" magit-blame-addition)
|
2020-06-04 21:50:03 +00:00
|
|
|
("r" magit-blame-removal)
|
|
|
|
("f" magit-blame-reverse)
|
|
|
|
("e" magit-blame-echo)
|
|
|
|
;; q closes any open blame buffers, one at a time,
|
|
|
|
;; closing the last blame buffer disables magit-blame-mode,
|
|
|
|
;; pressing q in this state closes the git blame TS
|
|
|
|
("q" magit-blame-quit :exit (not (bound-and-true-p magit-blame-mode)))
|
|
|
|
;; other
|
|
|
|
("c" magit-blame-cycle-style)
|
|
|
|
("Y" magit-blame-copy-hash)
|
|
|
|
("B" magit-blame :exit t)
|
|
|
|
("Q" nil :exit t)))
|
2014-12-14 04:59:02 +00:00
|
|
|
:config
|
|
|
|
(progn
|
2015-07-02 04:36:26 +00:00
|
|
|
;; seems to be necessary at the time of release
|
|
|
|
(require 'git-rebase)
|
2015-11-29 04:08:30 +00:00
|
|
|
;; bind function keys
|
|
|
|
;; (define-key magit-mode-map (kbd "<tab>") 'magit-section-toggle)
|
2016-09-12 14:54:26 +00:00
|
|
|
(evilified-state-evilify-map magit-repolist-mode-map
|
2020-01-23 22:53:38 +00:00
|
|
|
:mode magit-repolist-mode
|
|
|
|
:bindings
|
|
|
|
(kbd "gr") 'magit-list-repositories
|
|
|
|
(kbd "RET") 'magit-repolist-status)
|
2016-07-05 02:35:05 +00:00
|
|
|
;; confirm/abort
|
2015-10-28 13:13:11 +00:00
|
|
|
(when dotspacemacs-major-mode-leader-key
|
|
|
|
(add-hook 'with-editor-mode-hook 'evil-normalize-keymaps)
|
2015-12-05 18:27:55 +00:00
|
|
|
(let ((mm-key dotspacemacs-major-mode-leader-key))
|
|
|
|
(dolist (state '(normal motion))
|
|
|
|
(evil-define-key state with-editor-mode-map
|
2020-07-06 22:49:56 +00:00
|
|
|
(concat (kbd mm-key) (kbd mm-key)) 'with-editor-finish
|
|
|
|
(concat (kbd mm-key) "a") 'with-editor-cancel
|
|
|
|
(concat (kbd mm-key) "c") 'with-editor-finish
|
|
|
|
(concat (kbd mm-key) "k") 'with-editor-cancel)
|
2018-11-07 04:37:36 +00:00
|
|
|
(evil-define-key state magit-log-select-mode-map
|
2020-07-06 22:49:56 +00:00
|
|
|
(concat (kbd mm-key) (kbd mm-key)) 'magit-log-select-pick
|
|
|
|
(concat (kbd mm-key) "a") 'magit-log-select-quit
|
|
|
|
(concat (kbd mm-key) "c") 'magit-log-select-pick
|
|
|
|
(concat (kbd mm-key) "k") 'magit-log-select-quit))))
|
2015-07-02 04:36:26 +00:00
|
|
|
;; whitespace
|
|
|
|
(define-key magit-status-mode-map (kbd "C-S-w")
|
2016-07-05 02:35:05 +00:00
|
|
|
'spacemacs/magit-toggle-whitespace)
|
2020-11-27 21:13:25 +00:00
|
|
|
;; Add missing which-key prefixes using the new keymap api
|
2020-12-06 15:44:49 +00:00
|
|
|
(when (spacemacs//support-evilified-buffer-p dotspacemacs-editing-style)
|
2020-12-01 12:19:20 +00:00
|
|
|
(which-key-add-keymap-based-replacements magit-status-mode-map
|
|
|
|
"gf" "jump-to-unpulled"
|
|
|
|
"gp" "jump-to-unpushed"))
|
2020-10-23 16:21:22 +00:00
|
|
|
;; https://magit.vc/manual/magit/MacOS-Performance.html
|
|
|
|
;; But modified according Tommi Komulainen's advice: "...going through
|
|
|
|
;; shell raises an eyebrow, and in the odd edge case of not having git
|
|
|
|
;; setting the executable to empty string(?) feels slightly wrong."
|
|
|
|
(when-let ((git (executable-find "git")))
|
|
|
|
(setq magit-git-executable git))
|
2016-07-05 02:35:05 +00:00
|
|
|
;; full screen magit-status
|
|
|
|
(when git-magit-status-fullscreen
|
2019-02-21 07:31:05 +00:00
|
|
|
(setq magit-display-buffer-function
|
2019-04-21 11:22:11 +00:00
|
|
|
'magit-display-buffer-fullframe-status-v1))
|
2019-09-21 06:13:18 +00:00
|
|
|
(spacemacs|hide-lighter with-editor-mode)
|
|
|
|
;; Workaround for #12747 - org-mode
|
2020-03-27 19:40:15 +00:00
|
|
|
(evil-define-key 'normal magit-blame-read-only-mode-map (kbd "RET") 'magit-show-commit)
|
|
|
|
;; Make sure that M-m still switch windows in all magit buffers
|
2021-01-03 18:38:15 +00:00
|
|
|
(evil-define-key 'normal magit-section-mode-map (kbd "M-1") 'spacemacs/winum-select-window-1)
|
|
|
|
(evil-define-key 'normal magit-section-mode-map (kbd "M-2") 'spacemacs/winum-select-window-2)
|
|
|
|
(evil-define-key 'normal magit-section-mode-map (kbd "M-3") 'spacemacs/winum-select-window-3)
|
|
|
|
(evil-define-key 'normal magit-section-mode-map (kbd "M-4") 'spacemacs/winum-select-window-4)
|
|
|
|
(evil-define-key 'normal magit-section-mode-map (kbd "M-5") 'spacemacs/winum-select-window-5)
|
|
|
|
(evil-define-key 'normal magit-section-mode-map (kbd "M-6") 'spacemacs/winum-select-window-6)
|
|
|
|
(evil-define-key 'normal magit-section-mode-map (kbd "M-7") 'spacemacs/winum-select-window-7)
|
|
|
|
(evil-define-key 'normal magit-section-mode-map (kbd "M-8") 'spacemacs/winum-select-window-8)
|
|
|
|
(evil-define-key 'normal magit-section-mode-map (kbd "M-9") 'spacemacs/winum-select-window-9))))
|
2014-12-14 04:59:02 +00:00
|
|
|
|
2020-09-21 13:08:06 +00:00
|
|
|
(defun git/init-magit-delta ()
|
|
|
|
(use-package magit-delta
|
|
|
|
:defer t
|
|
|
|
:init (add-hook 'magit-mode-hook 'magit-delta-mode)))
|
|
|
|
|
2014-12-14 04:59:02 +00:00
|
|
|
(defun git/init-magit-gitflow ()
|
|
|
|
(use-package magit-gitflow
|
2019-02-18 17:56:45 +00:00
|
|
|
:defer t
|
2020-09-23 20:31:44 +00:00
|
|
|
:init (progn
|
|
|
|
(add-hook 'magit-mode-hook 'turn-on-magit-gitflow)
|
|
|
|
(setq magit-gitflow-popup-key "%"))
|
2019-02-18 17:56:45 +00:00
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(spacemacs|diminish magit-gitflow-mode "Flow")
|
|
|
|
(define-key magit-mode-map "%" 'magit-gitflow-popup))))
|
2014-12-14 04:59:02 +00:00
|
|
|
|
2020-01-23 22:53:38 +00:00
|
|
|
(defun git/init-magit-section ()
|
|
|
|
(use-package magit-section
|
|
|
|
:defer t))
|
|
|
|
|
2015-01-27 05:17:51 +00:00
|
|
|
(defun git/init-magit-svn ()
|
|
|
|
(use-package magit-svn
|
2018-05-24 16:21:40 +00:00
|
|
|
:if git-enable-magit-svn-plugin
|
2015-01-27 05:17:51 +00:00
|
|
|
:commands turn-on-magit-svn
|
2018-05-24 16:21:40 +00:00
|
|
|
:init (add-hook 'magit-mode-hook 'turn-on-magit-svn)
|
|
|
|
:config (progn
|
|
|
|
(spacemacs|diminish magit-svn-mode "SVN")
|
2019-02-18 18:38:50 +00:00
|
|
|
(define-key magit-mode-map "~" 'magit-svn))))
|
2015-01-27 05:17:51 +00:00
|
|
|
|
2018-11-29 13:03:26 +00:00
|
|
|
(defun git/init-orgit ()
|
|
|
|
(use-package orgit
|
|
|
|
:defer t))
|
2015-12-20 06:02:12 +00:00
|
|
|
|
2019-09-20 16:16:22 +00:00
|
|
|
(defun git/post-init-org ()
|
|
|
|
;; unfold the org headings for a target line
|
|
|
|
(advice-add 'magit-blame-addition :after #'spacemacs/org-reveal-advice)
|
|
|
|
(advice-add 'magit-diff-visit-file :after #'spacemacs/org-reveal-advice)
|
|
|
|
(advice-add 'magit-diff-visit-worktree-file
|
|
|
|
:after #'spacemacs/org-reveal-advice))
|
|
|
|
|
2014-12-14 04:59:02 +00:00
|
|
|
(defun git/init-smeargle ()
|
|
|
|
(use-package smeargle
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2014-12-14 04:59:02 +00:00
|
|
|
:init
|
2015-08-07 01:40:28 +00:00
|
|
|
(progn
|
2015-11-02 05:16:13 +00:00
|
|
|
(spacemacs/declare-prefix "gH" "highlight")
|
2017-07-02 13:48:06 +00:00
|
|
|
(when (configuration-layer/package-used-p 'which-key)
|
2015-11-02 05:16:13 +00:00
|
|
|
;; TODO abstract this to a function
|
|
|
|
(let ((descr
|
|
|
|
'(("smeargle" . "highlight by last update time")
|
|
|
|
("smeargle-commits" . "highlight by age of changes")
|
|
|
|
("smeargle-clear" . "clear"))))
|
|
|
|
(dolist (nd descr)
|
|
|
|
;; ensure the target matches the whole string
|
2019-02-21 07:31:05 +00:00
|
|
|
(push (cons (cons nil (concat "\\`" (car nd) "\\'"))
|
|
|
|
(cons nil (cdr nd)))
|
2016-11-22 18:34:22 +00:00
|
|
|
which-key-replacement-alist))))
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys
|
2015-11-02 05:16:13 +00:00
|
|
|
"gHc" 'smeargle-clear
|
|
|
|
"gHh" 'smeargle-commits
|
|
|
|
"gHt" 'smeargle))))
|
2019-02-18 16:03:08 +00:00
|
|
|
|
2020-12-23 13:07:51 +00:00
|
|
|
(defun git/pre-init-transient ()
|
|
|
|
(setq transient-history-file (expand-file-name "transient/history.el"
|
|
|
|
spacemacs-cache-directory))
|
|
|
|
(setq transient-levels-file (expand-file-name "transient/levels.el"
|
|
|
|
spacemacs-cache-directory))
|
|
|
|
(setq transient-values-file (expand-file-name "transient/values.el"
|
|
|
|
spacemacs-cache-directory)))
|
|
|
|
|
2019-02-18 16:03:08 +00:00
|
|
|
(defun git/init-transient ()
|
|
|
|
(use-package transient
|
2020-12-23 13:07:51 +00:00
|
|
|
:defer t))
|
2020-11-14 16:53:33 +00:00
|
|
|
|
2020-11-16 22:35:26 +00:00
|
|
|
(defun git/init-forge ()
|
2020-11-14 16:53:33 +00:00
|
|
|
(use-package forge
|
|
|
|
:after magit
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(setq forge-database-file (concat spacemacs-cache-directory
|
|
|
|
"forge-database.sqlite"))
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'forge-topic-mode
|
|
|
|
"c" 'forge-create-post
|
|
|
|
"e" 'forge-edit-post)
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'forge-post-mode
|
|
|
|
dotspacemacs-major-mode-leader-key 'forge-post-submit
|
|
|
|
"c" 'forge-post-submit
|
|
|
|
"k" 'forge-post-cancel
|
|
|
|
"a" 'forge-post-cancel))))
|