summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init/20-keymaps.el16
-rw-r--r--init/km-func.el16
-rw-r--r--init/km-keybindings.el24
3 files changed, 35 insertions, 21 deletions
diff --git a/init/20-keymaps.el b/init/20-keymaps.el
new file mode 100644
index 0000000..f694d16
--- /dev/null
+++ b/init/20-keymaps.el
@@ -0,0 +1,16 @@
+(define-prefix-command 'replace-map)
+(global-set-key (kbd "C-c r") 'replace-map)
+
+(define-prefix-command 'kill-map)
+(global-set-key (kbd "C-c k") 'kill-map)
+
+(define-prefix-command 'comment-map)
+(global-set-key (kbd "C-c c") 'comment-map)
+
+(define-prefix-command 'insert-map)
+(global-set-key (kbd "C-c i") 'insert-map)
+
+;; multiple cursors
+;; put under insert prefix
+(define-prefix-command 'multiple-cursors-map)
+(define-key insert-map "m" 'multiple-cursors-map)
diff --git a/init/km-func.el b/init/km-func.el
index e32db22..e12fdc7 100644
--- a/init/km-func.el
+++ b/init/km-func.el
@@ -48,13 +48,13 @@
(if (= (length lang) 0)
(setq lang "python"))
(insert "#!/usr/bin/env " lang "\n"))
-(global-set-key (kbd "C-c i s") 'km/shebang)
+(define-key insert-map "s" 'km/shebang)
(defun km/insert-date ()
(interactive)
(insert (format-time-string "%Y-%m-%d")))
-(global-set-key (kbd "C-c i d") 'km/insert-date)
+(define-key insert-map "d" 'km/insert-date)
(defun km/start-ess ()
(interactive)
@@ -136,11 +136,11 @@ KILLARG."
(interactive "P")
(km/kill-thing-at-point 'sexp 'kill-sexp arg))
-(global-set-key (kbd "C-c k s") 'km/kill-string-at-point)
-(global-set-key (kbd "C-c k .") 'km/kill-sentence-at-point)
-(global-set-key (kbd "C-c k w") 'km/kill-word-at-point)
-(global-set-key (kbd "C-c k p") 'km/kill-paragraph-at-point)
-(global-set-key (kbd "C-c k l") 'km/kill-line-at-point)
+(define-key kill-map "s" 'km/kill-string-at-point)
+(define-key kill-map "." 'km/kill-sentence-at-point)
+(define-key kill-map "w" 'km/kill-word-at-point)
+(define-key kill-map "p" 'km/kill-paragraph-at-point)
+(define-key kill-map "l" 'km/kill-line-at-point)
(defun km/join-next-line-with-space ()
"Join current line to the next line with a space in between"
@@ -149,7 +149,7 @@ KILLARG."
(kill-line)
(just-one-space))
-(global-set-key (kbd "C-c k j") 'km/join-next-line-with-space)
+(define-key kill-map "j" 'km/join-next-line-with-space)
(defadvice recompile (around restore-windows)
"Prevent recompiling from spawning new windows"
diff --git a/init/km-keybindings.el b/init/km-keybindings.el
index c0d3d25..39037e0 100644
--- a/init/km-keybindings.el
+++ b/init/km-keybindings.el
@@ -1,8 +1,6 @@
;; keybindings that don't go with other topics
(global-set-key (kbd "C-x \\") 'align-regexp)
-(global-set-key (kbd "C-c i i") 'indent-relative)
-
(global-set-key (kbd "C-x K") 'kill-buffer-and-window)
;; overrides `suspend-emacs' (which is also bound to C-x C-z)
@@ -11,18 +9,18 @@
(global-set-key (kbd "C-'") 'backward-kill-word)
-(global-set-key (kbd "C-c r s") 'query-replace)
-(global-set-key (kbd "C-c r S") 'replace-string)
-(global-set-key (kbd "C-c r r") 'query-replace-regexp)
-(global-set-key (kbd "C-c r R") 'replace-regexp)
+(define-key replace-map "s" 'query-replace)
+(define-key replace-map "S" 'replace-string)
+(define-key replace-map "r" 'query-replace-regexp)
+(define-key replace-map "R" 'replace-regexp)
+
+(define-key comment-map "t" 'km/todo-comment)
-(global-set-key (kbd "C-c c t") 'km/todo-comment)
+(define-key insert-map "i" 'indent-relative)
-;; multiple cursors
-;; put under insert prefix
-(global-set-key (kbd "C-c i m l") 'mc/edit-lines)
-(global-set-key (kbd "C-c i m n") 'mc/mark-next-like-this)
-(global-set-key (kbd "C-c i m p") 'mc/mark-previous-like-this)
-(global-set-key (kbd "C-c i m a") 'mc/mark-all-like-this)
+(define-key multiple-cursors-map "l" 'mc/edit-lines)
+(define-key multiple-cursors-map "n" 'mc/mark-next-like-this)
+(define-key multiple-cursors-map "p" 'mc/mark-previous-like-this)
+(define-key multiple-cursors-map "a" 'mc/mark-all-like-this)
(global-set-key (kbd "C-;") 'er/expand-region)