diff options
Diffstat (limited to 'emacs/.config')
-rw-r--r-- | emacs/.config/emacs-kj/init.el | 73 | ||||
-rw-r--r-- | emacs/.config/emacs-kj/lisp/kj-multiple-cursors.el | 25 |
2 files changed, 35 insertions, 63 deletions
diff --git a/emacs/.config/emacs-kj/init.el b/emacs/.config/emacs-kj/init.el index b771a0c..3658e63 100644 --- a/emacs/.config/emacs-kj/init.el +++ b/emacs/.config/emacs-kj/init.el @@ -553,15 +553,6 @@ (require 'kj-development) (require 'kj-eshell) -(defun kj/modules (module-directory) - (cl-loop for path in (f-files module-directory) - if (string-match "\\([^/]*\\).el" path) - collect (intern (match-string 1 path)))) - -(dolist (module (kj/modules - (expand-file-name "lisp" user-emacs-directory))) - (require module)) - (setq math-additional-units '((ZiB "1024 * EiB" "Zebibyte") (EiB "1024 * PiB" "Exbibyte") @@ -781,60 +772,6 @@ (interactive) (previous-line kj/some-lines)) -(use-package emacs - :init - (defvar kj/leader-map - (make-sparse-keymap) - "Keymap for leader key") - :bind (:repeat-map kj/leader-map - ("." . mc/mark-next-like-this) - ("," . mc/mark-previous-like-this) - ("C-." . mc/skip-to-next-like-this) - ("C-," . mc/skip-to-previous-like-this) - ("<" . mc/unmark-next-like-this) - (">" . mc/unmark-previous-like-this) - ("*" . mc/mark-all-like-this) - ("w" . mc/mark-next-like-this-word) - ("W" . mc/mark-all-words-like-this) - ("s" . set-rectangular-region-anchor) - ("y" . mc/mark-next-like-this-symbol) - ("Y" . mc/mark-all-like-this-symbol) - ("d" . kj/forward-some-lines) - ("u" . kj/previous-some-lines) - ("C-SPC" . mc/mark-pop) - ("(" . mc/mark-all-symbols-like-this-in-defun) - ("C-(" . mc/mark-all-words-like-this-in-defun) - ("M-(" . mc/mark-all-like-this-in-defun) - :exit - ("s" . shell) - ("$" . eshell) - ("b" . consult-buffer)) - - :bind (("S-<down-mouse-1>") - ("S-<mouse-1>" . mc/add-cursor-on-click)) - - :bind (:map selected-keymap - ("C-." . mc/skip-to-next-like-this) - ("C-," . mc/skip-to-previous-like-this) - ("." . mc/mark-next-like-this) - ("," . mc/mark-previous-like-this) - ("w" . mc/mark-next-like-this-word) - ("W" . mc/mark-all-words-like-this) - ("s" . set-rectangular-region-anchor) - ("y" . mc/mark-next-like-this-symbol) - ("Y" . mc/mark-all-like-this-symbol))) - -(defvar kj/keys-minor-mode-map - (let ((map (make-sparse-keymap))) - (define-key map (kbd "C-t") kj/leader-map) - map) - "Keymap for kj/keys-minor-mode") -(define-minor-mode kj/keys-minor-mode - "A minor mode so that my key settings override annoying major modes." - :init-value t - :lighter " kj-keys") -(kj/keys-minor-mode 1) - ;; Repeat commands (e.g., C-x o o o) ;; (use-package repeat-help ;; :ensure t ;; or :straight t @@ -946,5 +883,15 @@ (put 'narrow-to-region 'disabled nil) (put 'downcase-region 'disabled nil) +(defun kj/modules (module-directory) + (cl-loop for path in (f-files module-directory) + if (string-match "\\([^/]*\\).el" path) + collect (intern (match-string 1 path)))) + +(dolist (module (kj/modules + (expand-file-name "lisp" user-emacs-directory))) + (require module)) + ;; Restore gc. (setq gc-cons-threshold (* 16 1024 1024)) + diff --git a/emacs/.config/emacs-kj/lisp/kj-multiple-cursors.el b/emacs/.config/emacs-kj/lisp/kj-multiple-cursors.el new file mode 100644 index 0000000..fe928cf --- /dev/null +++ b/emacs/.config/emacs-kj/lisp/kj-multiple-cursors.el @@ -0,0 +1,25 @@ +;;; -*- lexical-binding: t; -*- + +(use-package multiple-cursors + :config + (defvar kj/multiple-cursors-map (make-sparse-keymap)) + (define-key kj/multiple-cursors-map "." '("→ this" . mc/mark-next-like-this)) + (define-key kj/multiple-cursors-map "," '("← this" . mc/mark-previous-like-this)) + (define-key kj/multiple-cursors-map ">" '("⇥ this" . mc/skip-to-next-like-this)) + (define-key kj/multiple-cursors-map "<" '("⇤ this" . mc/skip-to-previous-like-this)) + (define-key kj/multiple-cursors-map "<" '("⇤ this" . mc/skip-to-previous-like-this)) + (define-key kj/multiple-cursors-map "*" '("all like this" . mc/mark-all-like-this)) + (define-key kj/multiple-cursors-map "w" '("word" . mc/mark-next-like-this-word)) + (define-key kj/multiple-cursors-map "s" '("symbol" . mc/mark-next-like-this-symbol)) + (define-key kj/multiple-cursors-map "(" '("symbol defun" . mc/mark-all-symbols-like-this-in-defun)) + (define-key kj/multiple-cursors-map (kbd "DEL") '("DEL last" . mc/unmark-next-like-this)) + (define-key kj/multiple-cursors-map (kbd "<delete>") '("DEL first" . mc/unmark-previous-like-this)) + (global-set-key (kbd "C-c m") (cons "cursors" kj/multiple-cursors-map)) + + (map-keymap + (lambda (_key cmd) + (put (cdr cmd) 'repeat-map 'kj/multiple-cursors-map)) + kj/multiple-cursors-map) + ) +(provide 'kj-multiple-cursors) + |