From eae8476aec04043d36991af2c95e045b1d8ae56f Mon Sep 17 00:00:00 2001 From: contrapunctus Date: Thu, 23 Apr 2020 12:28:36 +0530 Subject: [PATCH] Move modal editing configurations to their own file --- .gitignore | 1 + contrapunctus/cp-god.el | 2 + contrapunctus/cp-modal.el | 128 ++++++++++++++++++++++++++++++++++++++ init.el | 128 +------------------------------------- 4 files changed, 133 insertions(+), 126 deletions(-) create mode 100644 contrapunctus/cp-modal.el diff --git a/.gitignore b/.gitignore index 74a5e4b..648d8da 100755 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ * !*.el +!contrapunctus .* diff --git a/contrapunctus/cp-god.el b/contrapunctus/cp-god.el index 3287073..ad65daf 100644 --- a/contrapunctus/cp-god.el +++ b/contrapunctus/cp-god.el @@ -32,3 +32,5 @@ ("" . god-mode-isearch-activate)) (:map god-mode-isearch-map ("" . god-mode-isearch-disable)))) + +(provide 'cp-god) diff --git a/contrapunctus/cp-modal.el b/contrapunctus/cp-modal.el new file mode 100644 index 0000000..a6fb3c5 --- /dev/null +++ b/contrapunctus/cp-modal.el @@ -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 + (("" . #'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) diff --git a/init.el b/init.el index ae2aa8a..5127f6a 100644 --- a/init.el +++ b/init.el @@ -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 - (("" . #'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")