Move modal editing configurations to their own file

This commit is contained in:
contrapunctus 2020-04-23 12:28:36 +05:30
parent b92c188f20
commit eae8476aec
4 changed files with 133 additions and 126 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*
!*.el
!contrapunctus
.*

View File

@ -32,3 +32,5 @@
("<escape>" . god-mode-isearch-activate))
(:map god-mode-isearch-map
("<escape>" . god-mode-isearch-disable))))
(provide 'cp-god)

128
contrapunctus/cp-modal.el Normal file
View File

@ -0,0 +1,128 @@
;; modal editing configurations
;; normal boon config
(use-package boon
:ensure t
:commands (boon-mode)
:bind
(:map boon-command-map
("C-l" . recenter-top-bottom)
("r" . swiper)
("/" . undo-tree-undo)
("?" . undo-tree-redo)
("J" . join-line)
("TAB" . 'company-indent-or-complete-common)
("C" . 'boon-toggle-comment)
("t" . nil)
("t w" . 'transpose-words)
("t e" . 'transpose-sexps)
("t l" . 'transpose-lines)
("t p" . 'transpose-paragraphs))
(:map boon-x-map
("s" . 'save-buffer)
("d" . 'dired-jump)
("e" . 'eval-last-sexp)
("f" . 'find-file)
("l" . 'ido-mini)
("c" . 'kill-emacs)
("v" . 'find-alternate-file)
("b" . 'ibuffer)
("=" . text-scale-adjust)
("-" . text-scale-adjust))
:config
(use-package boon-qwerty)
(add-to-list 'boon-enclosures `(40 "(" ")")) ;; opening paren
(use-package boon-powerline)
(boon-powerline-theme)
(mapc (lambda (mode)
(add-to-list 'boon-special-mode-list mode))
'(emms-playlist-mode
emms-browser-mode))
(add-to-list 'boon-special-conditions 'edebug-mode)
;; :hook
;; ((text-mode . turn-on-boon-mode)
;; (prog-mode . turn-on-boon-mode)
;; (shell-mode . turn-on-boon-mode)
;; (helpful-mode . turn-on-boon-mode)
;; (fundamental-mode . turn-on-boon-mode))
:init
(boon-mode))
;; experimental boon+modalka config
(use-package boon
:ensure t
:disabled
:bind
("C-d" . 'boon-take-region)
("C-a" . 'boon-beginning-of-line)
("C-e" . 'boon-end-of-line)
("M-f" . 'boon-smarter-forward)
("M-b" . 'boon-smarter-backward))
;; experimental Emacs-flavored-Boon config
(use-package boon
:ensure t
:disabled
:bind
(:map boon-command-map
("n" . next-line)
("p" . previous-line)
("f" . 'forward-char)
("b" . 'backward-char)
("a" . 'boon-beginning-of-line)
("e" . 'boon-end-of-line)
("y" . 'boon-splice)
("r" . swiper)
("x l" . ido-mini)
("/" . undo-tree-undo)
("?" . undo-tree-redo))
(:map boon-x-map
("s" . #'save-buffer)
("d" . #'dired-jump))
:config
(use-package boon-qwerty)
(boon-mode))
(use-package modalka
:ensure t
:disabled
:bind
(("<escape>" . #'modalka-mode)
:map modalka-mode-map
("J" . #'join-line)
("P" . #'backward-paragraph)
("N" . #'forward-paragraph)
("M" . mark-sexp))
;; (2019-11-03) I'm pretty much using this to emulate `god-mode',
;; which was great, but is no longer actively developed and had no
;; support for non-Latin input methods.
:config
(let ((keybind-re (rx-to-string '(group-n 1 (or (and bow (1+ (char graph)) eow)
(and (1+ (char graph))))))))
(mapc
(lambda (actual)
(let ((target (replace-regexp-in-string keybind-re "C-\\1" actual)))
(modalka-define-kbd actual target)))
;; no "t", "x", or "c", because they are prefix keys used later
'("`" "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" "-" "="
"q" "w" "e" "r" "y" "u" "i" "o" "p" "[" "]" "\\"
"a" "s" "d" "f" "h" "j" "k" "l" ";" "'"
"z" "v" "b" "n" "m" "," "." "/"
"<" ">" "?"
"SPC"
;; (2019-11-03) It's a little unfortunate that these cannot be
;; elided by entering ("x" "C-x") ("t" "C-t") ("c" "C-c") just
;; once :\ (I did try)
"x =" "x -" "x e" "x s" "x d"
"x f" "x l" "x x" "x c" "x v" "x b"
"t w" "t e" "t l"
"c n" "c ," "c ." "c p"
"c c n" "c h u" "c h m")))
(modalka-define-kbd "O" "C-S-o")
(setq-default cursor-type '(bar . 1))
(setq modalka-cursor-type 'box)
:hook
((text-mode . modalka-mode)
(prog-mode . modalka-mode)))
(provide 'cp-modal)

128
init.el
View File

@ -75,88 +75,8 @@
:config
(setq ag-highlight-search t))
;; normal boon config
(use-package boon
:ensure t
:commands (boon-mode)
:bind
(:map boon-command-map
("C-l" . recenter-top-bottom)
("r" . swiper)
("/" . undo-tree-undo)
("?" . undo-tree-redo)
("J" . join-line)
("TAB" . 'company-indent-or-complete-common)
("C" . 'boon-toggle-comment)
("t" . nil)
("t w" . 'transpose-words)
("t e" . 'transpose-sexps)
("t l" . 'transpose-lines)
("t p" . 'transpose-paragraphs))
(:map boon-x-map
("s" . 'save-buffer)
("d" . 'dired-jump)
("e" . 'eval-last-sexp)
("f" . 'find-file)
("l" . 'ido-mini)
("c" . 'kill-emacs)
("v" . 'find-alternate-file)
("b" . 'ibuffer)
("=" . text-scale-adjust)
("-" . text-scale-adjust))
:config
(use-package boon-qwerty)
(add-to-list 'boon-enclosures `(40 "(" ")")) ;; opening paren
(use-package boon-powerline)
(boon-powerline-theme)
(mapc (lambda (mode)
(add-to-list 'boon-special-mode-list mode))
'(emms-playlist-mode
emms-browser-mode))
(add-to-list 'boon-special-conditions 'edebug-mode)
;; :hook
;; ((text-mode . turn-on-boon-mode)
;; (prog-mode . turn-on-boon-mode)
;; (shell-mode . turn-on-boon-mode)
;; (helpful-mode . turn-on-boon-mode)
;; (fundamental-mode . turn-on-boon-mode))
:init
(boon-mode))
;; experimental boon+modalka config
(use-package boon
:ensure t
:disabled
:bind
("C-d" . 'boon-take-region)
("C-a" . 'boon-beginning-of-line)
("C-e" . 'boon-end-of-line)
("M-f" . 'boon-smarter-forward)
("M-b" . 'boon-smarter-backward))
;; experimental Emacs-flavored-Boon config
(use-package boon
:ensure t
:disabled
:bind
(:map boon-command-map
("n" . next-line)
("p" . previous-line)
("f" . 'forward-char)
("b" . 'backward-char)
("a" . 'boon-beginning-of-line)
("e" . 'boon-end-of-line)
("y" . 'boon-splice)
("r" . swiper)
("x l" . ido-mini)
("/" . undo-tree-undo)
("?" . undo-tree-redo))
(:map boon-x-map
("s" . #'save-buffer)
("d" . #'dired-jump))
:config
(use-package boon-qwerty)
(boon-mode))
(require 'cp-modal)
(require 'cp-god)
(use-package chronometrist
:ensure t
@ -861,49 +781,6 @@ and eval it."
clean-buffer-list-delay-general 7
clean-buffer-list-delay-special (* 60 60 24 7))
:hook
(midnight . clean-buffer-list))
(use-package modalka
:ensure t
:disabled
:bind
(("<escape>" . #'modalka-mode)
:map modalka-mode-map
("J" . #'join-line)
("P" . #'backward-paragraph)
("N" . #'forward-paragraph)
("M" . mark-sexp))
;; (2019-11-03) I'm pretty much using this to emulate `god-mode',
;; which was great, but is no longer actively developed and had no
;; support for non-Latin input methods.
:config
(let ((keybind-re (rx-to-string '(group-n 1 (or (and bow (1+ (char graph)) eow)
(and (1+ (char graph))))))))
(mapc
(lambda (actual)
(let ((target (replace-regexp-in-string keybind-re "C-\\1" actual)))
(modalka-define-kbd actual target)))
;; no "t", "x", or "c", because they are prefix keys used later
'("`" "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" "-" "="
"q" "w" "e" "r" "y" "u" "i" "o" "p" "[" "]" "\\"
"a" "s" "d" "f" "h" "j" "k" "l" ";" "'"
"z" "v" "b" "n" "m" "," "." "/"
"<" ">" "?"
"SPC"
;; (2019-11-03) It's a little unfortunate that these cannot be
;; elided by entering ("x" "C-x") ("t" "C-t") ("c" "C-c") just
;; once :\ (I did try)
"x =" "x -" "x e" "x s" "x d"
"x f" "x l" "x x" "x c" "x v" "x b"
"t w" "t e" "t l"
"c n" "c ," "c ." "c p"
"c c n" "c h u" "c h m")))
(modalka-define-kbd "O" "C-S-o")
(setq-default cursor-type '(bar . 1))
(setq modalka-cursor-type 'box)
:hook
((text-mode . modalka-mode)
(prog-mode . modalka-mode)))
(use-package nameless
:ensure t
@ -958,7 +835,6 @@ and eval it."
;; (load "cp-adb")
(load "cp-editing")
;; (load "cp-evil")
(load "cp-god")
(load "cp-fm")
(load "cp-lily")
(load "cp-sfz")