-
Notifications
You must be signed in to change notification settings - Fork 13
/
command-keys.lisp
115 lines (105 loc) · 3.58 KB
/
command-keys.lisp
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
105
106
107
108
109
110
111
112
113
114
115
;;;; Copyright (c) 2003, 2004 Nikodemus Siivola, Julian Squires
;;;;
;;;; Permission is hereby granted, free of charge, to any person obtaining
;;;; a copy of this software and associated documentation files (the
;;;; "Software"), to deal in the Software without restriction, including
;;;; without limitation the rights to use, copy, modify, merge, publish,
;;;; distribute, sublicense, and/or sell copies of the Software, and to
;;;; permit persons to whom the Software is furnished to do so, subject to
;;;; the following conditions:
;;;;
;;;; The above copyright notice and this permission notice shall be included
;;;; in all copies or substantial portions of the Software.
;;;;
;;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
;;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
;;;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
;;;; IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
;;;; CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
;;;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
;;;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
(in-package :linedit)
(defvar *commands* (make-hash-table :test #'equalp))
(defmacro defcommand (command &optional action)
(when action
`(setf (gethash ,command *commands*) ,action)))
(defcommand "C-A" 'move-to-bol)
(defcommand "C-B" 'move-char-left)
(defcommand "C-C" 'interrupt-lisp)
(defcommand "C-D" 'delete-char-forwards-or-eof)
(defcommand "C-E" 'move-to-eol)
(defcommand "C-F" 'move-char-right)
(defcommand "C-G")
(defcommand "C-J")
(defcommand "C-K" 'kill-to-eol)
(defcommand "C-L")
(defcommand "C-N" 'history-next)
(defcommand "C-O" 'close-all-sexp)
(defcommand "C-P" 'history-previous)
(defcommand "C-Q")
(defcommand "C-R" 'search-history-backwards)
(defcommand "C-S" 'search-history-forwards)
(defcommand "C-T")
(defcommand "C-U" 'kill-to-bol)
(defcommand "C-V")
(defcommand "C-W" 'cut-region)
(defcommand "C-X")
(defcommand "C-Y" 'yank)
(defcommand "C-Z" 'stop-lisp)
(defcommand "C--" 'undo)
(defcommand "M-A" 'apropos-word)
(defcommand "M-B" 'move-word-backwards)
(defcommand "M-C")
(defcommand "M-D" 'delete-word-forwards)
(defcommand "M-E")
(defcommand "M-F" 'move-word-forwards)
(defcommand "M-G")
(defcommand "M-H" 'help)
(defcommand "M-I" 'describe-word)
(defcommand "M-J")
(defcommand "M-K")
(defcommand "M-L" 'downcase-word)
(defcommand "M-M")
(defcommand "M-N")
(defcommand "M-O")
(defcommand "M-P")
(defcommand "M-Q")
(defcommand "M-R")
(defcommand "M-S")
(defcommand "M-T")
(defcommand "M-U" 'upcase-word)
(defcommand "M-V")
(defcommand "M-W" 'copy-region)
(defcommand "M-X")
(defcommand "M-Y" 'yank-cycle)
(defcommand "M-Z")
(defcommand "M-1")
(defcommand "M-2")
(defcommand "M-3")
(defcommand "M-4")
(defcommand "M-5")
(defcommand "M-6")
(defcommand "M-7")
(defcommand "M-8")
(defcommand "M-9")
(defcommand "M-0")
(defcommand "C-M-b" 'backward-sexp)
(defcommand "C-M-f" 'forward-sexp)
(defcommand "C-M-k" 'kill-sexp)
(defcommand "M-Backspace" 'delete-word-backwards)
(defcommand "C-Space" 'set-mark)
(defcommand "C-Backspace" 'delete-word-backwards)
(defcommand "Tab" 'complete)
(defcommand "Backspace" 'delete-char-backwards)
(defcommand "Return" 'finish-input)
(defcommand "Up-arrow" 'history-previous)
(defcommand "Down-arrow" 'history-next)
(defcommand "Right-arrow" 'move-char-right)
(defcommand "Left-arrow" 'move-char-left)
(defcommand "Insert" 'toggle-insert)
(defcommand "Delete" 'delete-char-forwards)
(defcommand "C-Delete")
(defcommand "Page-up")
(defcommand "Page-down")
(defcommand "Home" 'move-to-bol)
(defcommand "End" 'move-to-eol)