diff options
| author | Jack Jamison <jackqjamison@gmail.com> | 2026-07-05 01:19:30 -0400 |
|---|---|---|
| committer | Jack Jamison <jackqjamison@gmail.com> | 2026-07-05 01:19:30 -0400 |
| commit | bdf9a71ab7baa2b1de9abcfd5df1a9107a55d141 (patch) | |
| tree | c4524e6c41aa5107211103401dabfaefc81aa882 /.config/emacs/lisp/evil-collection/modes/magit-section | |
| parent | fe3984f541bd32bdfa418afb305b614176b55ca0 (diff) | |
add a bunch of emacs packages HELP
Diffstat (limited to '.config/emacs/lisp/evil-collection/modes/magit-section')
| -rw-r--r-- | .config/emacs/lisp/evil-collection/modes/magit-section/README.org | 47 | ||||
| -rw-r--r-- | .config/emacs/lisp/evil-collection/modes/magit-section/evil-collection-magit-section.el | 91 |
2 files changed, 138 insertions, 0 deletions
diff --git a/.config/emacs/lisp/evil-collection/modes/magit-section/README.org b/.config/emacs/lisp/evil-collection/modes/magit-section/README.org new file mode 100644 index 0000000..807238d --- /dev/null +++ b/.config/emacs/lisp/evil-collection/modes/magit-section/README.org @@ -0,0 +1,47 @@ +* magit-section + + Evil bindings for [[https://github.com/magit/magit][magit-section]], the foldable section UI used by magit, forge, + and several other packages. + +** Key bindings + + | Command | Original | Evil | + |----------------------------------+-----------+-----------| + | =magit-section-toggle= | =TAB= | =TAB= | + | =magit-section-cycle= | =C-<tab>= | =C-<tab>= | + | =magit-section-cycle= | =M-<tab>= | =M-<tab>= | + | =magit-section-cycle-global= | =backtab= | =backtab= | + | =magit-section-up= | =^= | =gh= | + | =magit-section-backward= | =p= | =C-k= | + | =magit-section-forward= | =n= | =C-j= | + | =magit-section-backward-sibling= | =M-p= | =gk=, =[= | + | =magit-section-forward-sibling= | =M-n= | =gj=, =]= | + | =magit-section-show-level-1= | =1= | =1= | + | =magit-section-show-level-2= | =2= | =2= | + | =magit-section-show-level-3= | =3= | =3= | + | =magit-section-show-level-4= | =4= | =4= | + | =magit-section-show-level-1-all= | =M-1= | =M-1= | + | =magit-section-show-level-2-all= | =M-2= | =M-2= | + | =magit-section-show-level-3-all= | =M-3= | =M-3= | + | =magit-section-show-level-4-all= | =M-4= | =M-4= | + + When =evil-collection-magit-section-use-z-for-folds= is non-nil, the + following vim-style fold bindings replace the =M-<digit>= variants: + + | Command | Evil | + |----------------------------------+------| + | =magit-section-show-level-1-all= | =z1= | + | =magit-section-show-level-2-all= | =z2= | + | =magit-section-show-level-3-all= | =z3= | + | =magit-section-show-level-4-all= | =z4= | + | =magit-section-show-level-4-all= | =zr= | + | =magit-section-toggle= | =za= | + | =magit-section-show= | =zo= | + | =magit-section-show-children= | =zO= | + | =magit-section-hide= | =zc= | + | =magit-section-hide-children= | =zC= | + +** Customization + + - =evil-collection-magit-section-use-z-for-folds= - When non-nil, use =z= as + a prefix for vim-style fold commands. The stash popup then moves to =Z=. diff --git a/.config/emacs/lisp/evil-collection/modes/magit-section/evil-collection-magit-section.el b/.config/emacs/lisp/evil-collection/modes/magit-section/evil-collection-magit-section.el new file mode 100644 index 0000000..2310393 --- /dev/null +++ b/.config/emacs/lisp/evil-collection/modes/magit-section/evil-collection-magit-section.el @@ -0,0 +1,91 @@ +;;; evil-collection-magit-section.el --- Bindings for magit-section -*- lexical-binding: t -*- + +;; Copyright (C) 2022 James Nguyen + +;; Author: James Nguyen <james@jojojames.com> +;; Maintainer: James Nguyen <james@jojojames.com> +;; URL: https://github.com/emacs-evil/evil-collection +;; Version: 0.0.2 +;; Package-Requires: ((emacs "27.1")) +;; Keywords: evil, emacs, convenience, tools + +;; 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: +;;; Bindings for magit-section. + +;;; Code: +(require 'evil-collection) +(require 'magit-section nil t) + +(defvar magit-section-mode-map) +(defconst evil-collection-magit-section-maps '(magit-section-mode-map)) + +(defcustom evil-collection-magit-section-use-z-for-folds nil + "When non nil, use \"z\" as a prefix for common vim fold commands, such as + - z1 Reset visibility to level 1 for all sections + - z2 Reset visibility to level 2 for all sections + - z3 Reset visibility to level 3 for all sections + - z4 Reset visibility to level 4 for all sections + - za Toggle a section + - zo Show section + - zO Show sections recursively + - zc Hide section + - zC Hide sections recursively + - zr Same as z4. + +When this option is enabled, the stash popup is available on \"Z\"." + :group 'magit + :type 'boolean) + +(defun evil-collection-magit-section-setup () + "Set up `evil' bindings for magit-section." + (if evil-collection-magit-section-use-z-for-folds + (evil-collection-define-key 'normal 'magit-section-mode-map + "z1" 'magit-section-show-level-1-all + "z2" 'magit-section-show-level-2-all + "z3" 'magit-section-show-level-3-all + "z4" 'magit-section-show-level-4-all + "za" 'magit-section-toggle + "zc" 'magit-section-hide + "zC" 'magit-section-hide-children + "zo" 'magit-section-show + "zO" 'magit-section-show-children + "zr" 'magit-section-show-level-4-all) + (evil-collection-define-key 'normal 'magit-section-mode-map + (kbd "M-1") 'magit-section-show-level-1-all + (kbd "M-2") 'magit-section-show-level-2-all + (kbd "M-3") 'magit-section-show-level-3-all + (kbd "M-4") 'magit-section-show-level-4-all)) + + (evil-collection-define-key 'normal 'magit-section-mode-map + (kbd "TAB") 'magit-section-toggle + [C-tab] 'magit-section-cycle + [M-tab] 'magit-section-cycle + ;; [backtab] is the most portable binding for Shift+Tab. + [backtab] 'magit-section-cycle-global + "gh" 'magit-section-up + (kbd "C-k") 'magit-section-backward + (kbd "C-j") 'magit-section-forward + "gk" 'magit-section-backward-sibling + "[" 'magit-section-backward-sibling + "gj" 'magit-section-forward-sibling + "]" 'magit-section-forward-sibling + (kbd "1") 'magit-section-show-level-1 + (kbd "2") 'magit-section-show-level-2 + (kbd "3") 'magit-section-show-level-3 + (kbd "4") 'magit-section-show-level-4)) + +(provide 'evil-collection-magit-section) +;;; evil-collection-magit-section.el ends here |
