forked from jyp/boon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
boon-keys.el
104 lines (83 loc) · 4.34 KB
/
boon-keys.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
;;; boon-keys.el --- An Ergonomic Command Mode -*- lexical-binding: t -*-
;;; Commentary:
;; This module defines various keymaps and portions of keymaps, common
;; to all keyboard layouts.
;;; Code:
(require 'boon-core)
(define-prefix-command 'boon-backward-search-map)
(define-prefix-command 'boon-forward-search-map)
(define-key boon-forward-search-map " " 'isearch-forward)
(define-key boon-forward-search-map "t" 'boon-qsearch-next-at-point)
(define-key boon-forward-search-map "s" 'boon-qsearch-next-at-point)
(define-key boon-forward-search-map "p" 'boon-qsearch-next)
(define-key boon-forward-search-map "e" 'next-error)
(define-key boon-forward-search-map "k" 'flycheck-next-error)
(define-key boon-forward-search-map "m" 'flymake-goto-next-error)
(define-key boon-forward-search-map "g" 'smerge-next)
(define-key boon-forward-search-map "b" 'next-buffer)
(define-key boon-forward-search-map "u" 'mc/cycle-forward)
(define-key boon-forward-search-map "c" 'iy-go-to-char)
(define-key boon-backward-search-map " " 'isearch-backward)
(define-key boon-backward-search-map "t" 'boon-qsearch-previous-at-point)
(define-key boon-backward-search-map "s" 'boon-qsearch-previous-at-point)
(define-key boon-backward-search-map "p" 'boon-qsearch-previous)
(define-key boon-backward-search-map "e" 'previous-error)
(define-key boon-backward-search-map "k" 'flycheck-previous-error)
(define-key boon-backward-search-map "m" 'flymake-goto-prev-error)
(define-key boon-backward-search-map "g" 'smerge-prev)
(define-key boon-backward-search-map "b" 'previous-buffer)
(define-key boon-backward-search-map "u" 'mc/cycle-backward)
(define-key boon-backward-search-map "c" 'iy-go-to-char-backward)
(define-prefix-command 'boon-goto-map)
(set-keymap-parent boon-goto-map goto-map)
(set-keymap-parent boon-goto-map goto-map)
(define-key boon-goto-map "l" 'goto-line)
(define-key boon-goto-map "." 'find-tag)
(define-key boon-x-map "x" 'execute-extended-command)
(define-key boon-x-map "n" 'boon-narrow)
(define-key boon-x-map "N" 'widen)
(define-key boon-select-map "@" 'boon-select-occurences)
(define-key boon-select-map "#" 'boon-select-all)
(define-key boon-select-map " " 'boon-select-line)
(define-key boon-moves-map "'" 'boon-switch-mark)
(define-key boon-moves-map (kbd "<left>") 'left-char)
(define-key boon-moves-map (kbd "<right>") 'right-char)
(define-key boon-moves-map (kbd "<up>") 'previous-line)
(define-key boon-moves-map (kbd "<down>") 'next-line)
(define-key boon-command-map "'" 'boon-toggle-mark)
(define-key boon-command-map [(return)] 'undefined)
(define-key boon-command-map (kbd "<RET>") 'undefined)
(define-key boon-command-map [(backspace)] 'undefined)
(define-key boon-command-map (kbd "<DEL>") 'undefined)
(define-key boon-command-map "`" 'boon-toggle-case)
(define-key boon-moves-map "[" '("[-" . boon-navigate-backward))
(define-key boon-moves-map "]" '("-]" . boon-navigate-forward))
(define-key boon-command-map "!" 'shell-command)
(define-key boon-command-map "|" 'shell-command-on-region)
(define-key boon-command-map "-" 'undo)
(dolist (number '("0" "1" "2" "3" "4" "5" "6" "7" "8" "9"))
(define-key boon-command-map number 'digit-argument))
(define-key boon-command-map "~" 'universal-argument)
(define-key universal-argument-map "~" 'universal-argument-more)
(defcustom boon-quit-key [escape] "Key to go back to command
state and generally exit local states and modes." :group 'boon
:type 'key-sequence)
(define-key boon-command-map " " 'boon-drop-mark)
(define-key boon-command-map boon-quit-key 'boon-quit)
;; Special mode rebinds
(define-key boon-special-map "`" 'boon-quote-character)
(define-key boon-special-map "'" 'boon-quote-character)
(define-key boon-special-map "x" boon-x-map)
(define-key boon-special-map boon-quit-key 'boon-set-command-state)
;; Insert mode rebinds
(define-key boon-insert-map [remap newline] 'boon-newline-dwim)
(define-key boon-insert-map boon-quit-key 'boon-set-command-state)
;; Global rebinds
(define-key global-map boon-quit-key 'keyboard-quit)
(define-key minibuffer-local-map boon-quit-key 'keyboard-quit)
(define-key minibuffer-local-ns-map boon-quit-key 'keyboard-quit)
(define-key minibuffer-local-completion-map boon-quit-key 'keyboard-quit)
(define-key minibuffer-local-must-match-map boon-quit-key 'keyboard-quit)
(define-key isearch-mode-map boon-quit-key 'isearch-abort)
(provide 'boon-keys)
;;; boon-keys.el ends here