| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Term::ReadLine::Perl5::Keymap; |
|
2
|
11
|
|
|
11
|
|
75
|
use strict; use warnings; |
|
|
11
|
|
|
11
|
|
29
|
|
|
|
11
|
|
|
|
|
349
|
|
|
|
11
|
|
|
|
|
69
|
|
|
|
11
|
|
|
|
|
24
|
|
|
|
11
|
|
|
|
|
365
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Term::ReadLine::Perl5::Keymap |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
A non-OO package subsidiary to L to |
|
10
|
|
|
|
|
|
|
initialize keymaps. |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=cut |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SUBROUTINES |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head2 KeymapEmacs |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
GNU Emacs key bindings |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
|
21
|
|
|
|
|
|
|
|
|
22
|
11
|
|
|
11
|
|
65
|
use Exporter; |
|
|
11
|
|
|
|
|
26
|
|
|
|
11
|
|
|
|
|
427
|
|
|
23
|
11
|
|
|
11
|
|
69
|
use vars qw(@ISA @EXPORT); @ISA = qw(Exporter); |
|
|
11
|
|
|
|
|
31
|
|
|
|
11
|
|
|
|
|
18670
|
|
|
24
|
|
|
|
|
|
|
@EXPORT = qw(KeymapEmacs KeymapVi KeymapVicmd KeymapVipos KeymapVisearch); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub KeymapEmacs($$$) { |
|
27
|
14
|
|
|
14
|
1
|
64
|
my ($fn, $keymap, $inDOS) = @_; |
|
28
|
|
|
|
|
|
|
&$fn($keymap, 'SelfInsert', 'emacs_keymap', |
|
29
|
|
|
|
|
|
|
($inDOS ? () : ('C-@', 'SetMark') ), |
|
30
|
|
|
|
|
|
|
'C-a', 'BeginningOfLine', |
|
31
|
|
|
|
|
|
|
'C-b', 'BackwardChar', |
|
32
|
|
|
|
|
|
|
'C-c', 'Interrupt', |
|
33
|
|
|
|
|
|
|
'C-d', 'DeleteChar', |
|
34
|
|
|
|
|
|
|
'C-e', 'EndOfLine', |
|
35
|
|
|
|
|
|
|
'C-f', 'ForwardChar', |
|
36
|
|
|
|
|
|
|
'C-g', 'Abort', |
|
37
|
|
|
|
|
|
|
'M-C-g', 'Abort', |
|
38
|
|
|
|
|
|
|
'C-h', 'BackwardDeleteChar', |
|
39
|
|
|
|
|
|
|
"TAB" , 'Complete', |
|
40
|
|
|
|
|
|
|
"C-j" , 'AcceptLine', |
|
41
|
|
|
|
|
|
|
'C-k', 'KillLine', |
|
42
|
|
|
|
|
|
|
'C-l', 'ClearScreen', |
|
43
|
|
|
|
|
|
|
"C-m" , 'AcceptLine', |
|
44
|
|
|
|
|
|
|
'C-n', 'NextHistory', |
|
45
|
|
|
|
|
|
|
'C-o', 'OperateAndGetNext', |
|
46
|
|
|
|
|
|
|
'C-p', 'PreviousHistory', |
|
47
|
|
|
|
|
|
|
'C-q', 'QuotedInsert', |
|
48
|
|
|
|
|
|
|
'C-r', 'ReverseSearchHistory', |
|
49
|
|
|
|
|
|
|
'C-s', 'ForwardSearchHistory', |
|
50
|
|
|
|
|
|
|
'C-t', 'TransposeChars', |
|
51
|
|
|
|
|
|
|
'C-u', 'UnixLineDiscard', |
|
52
|
|
|
|
|
|
|
##'C-v', 'QuotedInsert', |
|
53
|
|
|
|
|
|
|
'C-v', 'HistorySearchForward', |
|
54
|
|
|
|
|
|
|
'C-w', 'UnixWordRubout', |
|
55
|
|
|
|
|
|
|
qq/"\cX\cX"/, 'ExchangePointAndMark', |
|
56
|
|
|
|
|
|
|
qq/"\cX\cR"/, 'ReReadInitFile', |
|
57
|
|
|
|
|
|
|
qq/"\cX?"/, 'PossibleCompletions', |
|
58
|
|
|
|
|
|
|
qq/"\cX*"/, 'InsertPossibleCompletions', |
|
59
|
|
|
|
|
|
|
qq/"\cX\cU"/, 'Undo', |
|
60
|
|
|
|
|
|
|
qq/"\cXu"/, 'Undo', |
|
61
|
|
|
|
|
|
|
qq/"\cX\cW"/, 'KillRegion', |
|
62
|
|
|
|
|
|
|
qq/"\cXw"/, 'CopyRegionAsKill', |
|
63
|
|
|
|
|
|
|
qq/"\cX\ec\\*"/, 'DoControlVersion', |
|
64
|
|
|
|
|
|
|
qq/"\cX\ec\0"/, 'SetMark', |
|
65
|
|
|
|
|
|
|
qq/"\cX\ec\@"/, 'SetMark', |
|
66
|
|
|
|
|
|
|
qq/"\cX\ec "/, 'SetMark', |
|
67
|
|
|
|
|
|
|
qq/"\cX\em\\*"/, 'DoMetaVersion', |
|
68
|
|
|
|
|
|
|
qq/"\cX\@c\\*"/, 'DoControlVersion', |
|
69
|
|
|
|
|
|
|
qq/"\cX\@c\0"/, 'SetMark', |
|
70
|
|
|
|
|
|
|
qq/"\cX\@c\@"/, 'SetMark', |
|
71
|
|
|
|
|
|
|
qq/"\cX\@c "/, 'SetMark', |
|
72
|
|
|
|
|
|
|
qq/"\cX\@m\\*"/, 'DoMetaVersion', |
|
73
|
|
|
|
|
|
|
'C-y', 'Yank', |
|
74
|
|
|
|
|
|
|
'C-z', 'Suspend', |
|
75
|
|
|
|
|
|
|
'C-\\', 'Ding', |
|
76
|
|
|
|
|
|
|
'C-^', 'Ding', |
|
77
|
|
|
|
|
|
|
'C-_', 'Undo', |
|
78
|
|
|
|
|
|
|
'DEL', ($inDOS ? |
|
79
|
|
|
|
|
|
|
'BackwardKillWord' : # + |
|
80
|
|
|
|
|
|
|
'BackwardDeleteChar' |
|
81
|
|
|
|
|
|
|
), |
|
82
|
|
|
|
|
|
|
'M-<', 'BeginningOfHistory', |
|
83
|
|
|
|
|
|
|
'M->', 'EndOfHistory', |
|
84
|
|
|
|
|
|
|
'M-DEL', 'BackwardKillWord', |
|
85
|
|
|
|
|
|
|
'M-C-h', 'BackwardKillWord', |
|
86
|
|
|
|
|
|
|
'M-C-j', 'ViInput', |
|
87
|
|
|
|
|
|
|
'M-C-v', 'QuotedInsert', |
|
88
|
|
|
|
|
|
|
'M-b', 'BackwardWord', |
|
89
|
|
|
|
|
|
|
'M-c', 'CapitalizeWord', |
|
90
|
|
|
|
|
|
|
'M-d', 'KillWord', |
|
91
|
|
|
|
|
|
|
'M-f', 'ForwardWord', |
|
92
|
|
|
|
|
|
|
'M-h', 'PrintHistory', |
|
93
|
|
|
|
|
|
|
'M-l', 'DownCaseWord', |
|
94
|
|
|
|
|
|
|
'M-r', 'RevertLine', |
|
95
|
|
|
|
|
|
|
'M-t', 'TransposeWords', |
|
96
|
|
|
|
|
|
|
'M-u', 'UpcaseWord', |
|
97
|
|
|
|
|
|
|
'M-v', 'HistorySearchBackward', |
|
98
|
|
|
|
|
|
|
'M-y', 'YankPop', |
|
99
|
|
|
|
|
|
|
"M-?", 'PossibleCompletions', |
|
100
|
|
|
|
|
|
|
'M-~', 'TildeExpand', |
|
101
|
|
|
|
|
|
|
"M-TAB", 'TabInsert', |
|
102
|
|
|
|
|
|
|
'M-#', 'SaveLine', |
|
103
|
|
|
|
|
|
|
qq/"\e[A"/, 'previous-history', |
|
104
|
|
|
|
|
|
|
qq/"\e[B"/, 'next-history', |
|
105
|
|
|
|
|
|
|
qq/"\e[C"/, 'forward-char', |
|
106
|
|
|
|
|
|
|
qq/"\e[D"/, 'backward-char', |
|
107
|
|
|
|
|
|
|
qq/"\eOA"/, 'previous-history', |
|
108
|
|
|
|
|
|
|
qq/"\eOB"/, 'next-history', |
|
109
|
|
|
|
|
|
|
qq/"\eOC"/, 'forward-char', |
|
110
|
|
|
|
|
|
|
qq/"\eOD"/, 'backward-char', |
|
111
|
|
|
|
|
|
|
qq/"\eOy"/, 'HistorySearchBackward', # vt: PageUp |
|
112
|
|
|
|
|
|
|
qq/"\eOs"/, 'HistorySearchForward', # vt: PageDown |
|
113
|
|
|
|
|
|
|
qq/"\e[[A"/, 'previous-history', |
|
114
|
|
|
|
|
|
|
qq/"\e[[B"/, 'next-history', |
|
115
|
|
|
|
|
|
|
qq/"\e[[C"/, 'forward-char', |
|
116
|
|
|
|
|
|
|
qq/"\e[[D"/, 'backward-char', |
|
117
|
|
|
|
|
|
|
qq/"\e[2~"/, 'ToggleInsertMode', # X: |
|
118
|
|
|
|
|
|
|
# Mods: 1 + bitmask: 1 Shift, 2 Alt, 4 Control, 8 (sometimes) Meta |
|
119
|
|
|
|
|
|
|
qq/"\e[2;2~"/, 'YankClipboard', # + |
|
120
|
|
|
|
|
|
|
qq/"\e[3;2~"/, 'KillRegionClipboard', # + |
|
121
|
|
|
|
|
|
|
#qq/"\0\16"/, 'Undo', # + |
|
122
|
|
|
|
|
|
|
qq/"\eO5D"/, 'BackwardWord', # + |
|
123
|
|
|
|
|
|
|
qq/"\eO5C"/, 'ForwardWord', # + |
|
124
|
|
|
|
|
|
|
qq/"\e[5D"/, 'BackwardWord', # + |
|
125
|
|
|
|
|
|
|
qq/"\e[5C"/, 'ForwardWord', # + |
|
126
|
|
|
|
|
|
|
qq/"\eO5F"/, 'KillLine', # + |
|
127
|
|
|
|
|
|
|
qq/"\e[5F"/, 'KillLine', # + |
|
128
|
|
|
|
|
|
|
qq/"\e[4;5~"/, 'KillLine', # + |
|
129
|
|
|
|
|
|
|
qq/"\eO5s"/, 'EndOfHistory', # + |
|
130
|
|
|
|
|
|
|
qq/"\e[6;5~"/, 'EndOfHistory', # + |
|
131
|
|
|
|
|
|
|
qq/"\e[5H"/, 'BackwardKillLine', # + |
|
132
|
|
|
|
|
|
|
qq/"\eO5H"/, 'BackwardKillLine', # + |
|
133
|
|
|
|
|
|
|
qq/"\e[1;5~"/, 'BackwardKillLine', # + |
|
134
|
|
|
|
|
|
|
qq/"\eO5y"/, 'BeginningOfHistory', # + |
|
135
|
|
|
|
|
|
|
qq/"\e[5;5y"/, 'BeginningOfHistory', # + |
|
136
|
|
|
|
|
|
|
qq/"\e[2;5~"/, 'CopyRegionAsKillClipboard', # + |
|
137
|
|
|
|
|
|
|
qq/"\e[3;5~"/, 'KillWord', # + |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
# XTerm mouse editing (f202/f203 not in mainstream yet): |
|
140
|
|
|
|
|
|
|
# Paste may be: move f200 STRING f201 |
|
141
|
|
|
|
|
|
|
# or f202 move f200 STRING f201 f203; |
|
142
|
|
|
|
|
|
|
# and Cut may be f202 move delete f203 |
|
143
|
|
|
|
|
|
|
qq/"\e[200~"/, 'BeginPasteGroup', # Pre-paste |
|
144
|
|
|
|
|
|
|
qq/"\e[201~"/, 'EndPasteGroup', # Post-paste |
|
145
|
|
|
|
|
|
|
qq/"\e[202~"/, 'BeginEditGroup', # Pre-edit |
|
146
|
|
|
|
|
|
|
qq/"\e[203~"/, 'EndEditGroup', # Post-edit |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
# OSX xterm: |
|
149
|
|
|
|
|
|
|
# OSX xterm: home \eOH end \eOF delete \e[3~ help \e[28~ f13 \e[25~ |
|
150
|
|
|
|
|
|
|
# gray- \eOm gray+ \eOk gray-enter \eOM gray* \eOj gray/ \eOo gray= \eO |
|
151
|
|
|
|
|
|
|
# grayClear \e\e. |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
qq/"\eOH"/, 'BeginningOfLine', # home |
|
154
|
|
|
|
|
|
|
qq/"\eOF"/, 'EndOfLine', # end |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
# HP xterm |
|
157
|
|
|
|
|
|
|
#qq/"\e[A"/, 'PreviousHistory', # up arrow |
|
158
|
|
|
|
|
|
|
#qq/"\e[B"/, 'NextHistory', # down arrow |
|
159
|
|
|
|
|
|
|
#qq/"\e[C"/, 'ForwardChar', # right arrow |
|
160
|
|
|
|
|
|
|
#qq/"\e[D"/, 'BackwardChar', # left arrow |
|
161
|
|
|
|
|
|
|
qq/"\e[H"/, 'BeginningOfLine', # home |
|
162
|
|
|
|
|
|
|
#'C-k', 'KillLine', # clear display |
|
163
|
|
|
|
|
|
|
qq/"\e[5~"/, 'HistorySearchBackward', # prev |
|
164
|
|
|
|
|
|
|
qq/"\e[6~"/, 'HistorySearchForward', # next |
|
165
|
|
|
|
|
|
|
qq/"\e[\0"/, 'BeginningOfLine', # home |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
# These contradict: |
|
168
|
|
|
|
|
|
|
($^O =~ /^hp\W?ux/i ? ( |
|
169
|
|
|
|
|
|
|
qq/"\e[1~"/, 'HistorySearchForward', # find |
|
170
|
|
|
|
|
|
|
qq/"\e[3~"/, 'ToggleInsertMode', # insert char |
|
171
|
|
|
|
|
|
|
qq/"\e[4~"/, 'ToggleInsertMode', # select |
|
172
|
|
|
|
|
|
|
) : ( # "Normal" xterm |
|
173
|
|
|
|
|
|
|
qq/"\e[1~"/, 'BeginningOfLine', # home |
|
174
|
|
|
|
|
|
|
qq/"\e[3~"/, 'DeleteChar', # delete |
|
175
|
|
|
|
|
|
|
qq/"\e[4~"/, 'EndOfLine', # end |
|
176
|
|
|
|
|
|
|
)), |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
# hpterm |
|
179
|
|
|
|
|
|
|
|
|
180
|
14
|
50
|
33
|
|
|
602
|
(($ENV{'TERM'} and $ENV{'TERM'} eq 'hpterm') ? |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
( |
|
182
|
|
|
|
|
|
|
qq/"\eA"/, 'PreviousHistory', # up arrow |
|
183
|
|
|
|
|
|
|
qq/"\eB"/, 'NextHistory', # down arrow |
|
184
|
|
|
|
|
|
|
qq/"\eC"/, 'ForwardChar', # right arrow |
|
185
|
|
|
|
|
|
|
qq/"\eD"/, 'BackwardChar', # left arrow |
|
186
|
|
|
|
|
|
|
qq/"\eS"/, 'BeginningOfHistory', # shift up arrow |
|
187
|
|
|
|
|
|
|
qq/"\eT"/, 'EndOfHistory', # shift down arrow |
|
188
|
|
|
|
|
|
|
qq/"\e&r1R"/, 'EndOfLine', # shift right arrow |
|
189
|
|
|
|
|
|
|
qq/"\e&r1L"/, 'BeginningOfLine', # shift left arrow |
|
190
|
|
|
|
|
|
|
qq/"\eJ"/, 'ClearScreen', # clear display |
|
191
|
|
|
|
|
|
|
qq/"\eM"/, 'UnixLineDiscard', # delete line |
|
192
|
|
|
|
|
|
|
qq/"\eK"/, 'KillLine', # clear line |
|
193
|
|
|
|
|
|
|
qq/"\eG\eK"/, 'BackwardKillLine', # shift clear line |
|
194
|
|
|
|
|
|
|
qq/"\eP"/, 'DeleteChar', # delete char |
|
195
|
|
|
|
|
|
|
qq/"\eL"/, 'Yank', # insert line |
|
196
|
|
|
|
|
|
|
qq/"\eQ"/, 'ToggleInsertMode', # insert char |
|
197
|
|
|
|
|
|
|
qq/"\eV"/, 'HistorySearchBackward', # prev |
|
198
|
|
|
|
|
|
|
qq/"\eU"/, 'HistorySearchForward', # next |
|
199
|
|
|
|
|
|
|
qq/"\eh"/, 'BeginningOfLine', # home |
|
200
|
|
|
|
|
|
|
qq/"\eF"/, 'EndOfLine', # shift home |
|
201
|
|
|
|
|
|
|
qq/"\ei"/, 'Suspend', # shift tab |
|
202
|
|
|
|
|
|
|
) : |
|
203
|
|
|
|
|
|
|
() |
|
204
|
|
|
|
|
|
|
), |
|
205
|
|
|
|
|
|
|
($inDOS ? |
|
206
|
|
|
|
|
|
|
( |
|
207
|
|
|
|
|
|
|
qq/"\0\2"/, 'SetMark', # 2: + |
|
208
|
|
|
|
|
|
|
qq/"\0\3"/, 'SetMark', # 3: +<@> |
|
209
|
|
|
|
|
|
|
qq/"\0\4"/, 'YankClipboard', # 4: + |
|
210
|
|
|
|
|
|
|
qq/"\0\5"/, 'KillRegionClipboard', # 5: + |
|
211
|
|
|
|
|
|
|
qq/"\0\16"/, 'Undo', # 14: + |
|
212
|
|
|
|
|
|
|
qq/"\0\65"/, 'PossibleCompletions', # 53: +> |
|
213
|
|
|
|
|
|
|
qq/"\0\107"/, 'BeginningOfLine', # 71: |
|
214
|
|
|
|
|
|
|
qq/"\0\110"/, 'previous-history', # 72: |
|
215
|
|
|
|
|
|
|
qq/"\0\111"/, 'HistorySearchBackward', # 73: |
|
216
|
|
|
|
|
|
|
qq/"\0\113"/, 'backward-char', # 75: |
|
217
|
|
|
|
|
|
|
qq/"\0\115"/, 'forward-char', # 77: |
|
218
|
|
|
|
|
|
|
qq/"\0\117"/, 'EndOfLine', # 79: |
|
219
|
|
|
|
|
|
|
qq/"\0\120"/, 'next-history', # 80: |
|
220
|
|
|
|
|
|
|
qq/"\0\121"/, 'HistorySearchForward', # 81: |
|
221
|
|
|
|
|
|
|
qq/"\0\122"/, 'ToggleInsertMode', # 82: |
|
222
|
|
|
|
|
|
|
qq/"\0\123"/, 'DeleteChar', # 83: |
|
223
|
|
|
|
|
|
|
qq/"\0\163"/, 'BackwardWord', # 115: + |
|
224
|
|
|
|
|
|
|
qq/"\0\164"/, 'ForwardWord', # 116: + |
|
225
|
|
|
|
|
|
|
qq/"\0\165"/, 'KillLine', # 117: + |
|
226
|
|
|
|
|
|
|
qq/"\0\166"/, 'EndOfHistory', # 118: + |
|
227
|
|
|
|
|
|
|
qq/"\0\167"/, 'BackwardKillLine', # 119: + |
|
228
|
|
|
|
|
|
|
qq/"\0\204"/, 'BeginningOfHistory', # 132: + |
|
229
|
|
|
|
|
|
|
qq/"\0\x92"/, 'CopyRegionAsKillClipboard', # 146: + |
|
230
|
|
|
|
|
|
|
qq/"\0\223"/, 'KillWord', # 147: + |
|
231
|
|
|
|
|
|
|
qq/"\0#"/, 'PrintHistory', # Alt-H |
|
232
|
|
|
|
|
|
|
) |
|
233
|
|
|
|
|
|
|
: ( 'C-@', 'Ding') |
|
234
|
|
|
|
|
|
|
) |
|
235
|
|
|
|
|
|
|
); |
|
236
|
14
|
|
|
|
|
50
|
return $keymap; |
|
237
|
|
|
|
|
|
|
} |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=head2 KeymapVi |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
vi input-mode key bindings |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=cut |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
sub KeymapVi($$) { |
|
246
|
14
|
|
|
14
|
1
|
58
|
my ($fn, $keymap) = @_; |
|
247
|
|
|
|
|
|
|
# Vi input mode. |
|
248
|
14
|
|
|
|
|
107
|
&$fn($keymap, 'SelfInsert', 'vi_keymap', |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
"\e", 'ViEndInsert', |
|
251
|
|
|
|
|
|
|
'C-c', 'Interrupt', |
|
252
|
|
|
|
|
|
|
'C-h', 'BackwardDeleteChar', |
|
253
|
|
|
|
|
|
|
'C-u', 'UnixLineDiscard', |
|
254
|
|
|
|
|
|
|
'C-v', 'QuotedInsert', |
|
255
|
|
|
|
|
|
|
'C-w', 'UnixWordRubout', |
|
256
|
|
|
|
|
|
|
'DEL', 'BackwardDeleteChar', |
|
257
|
|
|
|
|
|
|
"\n", 'ViAcceptInsert', |
|
258
|
|
|
|
|
|
|
"\r", 'ViAcceptInsert', |
|
259
|
|
|
|
|
|
|
); |
|
260
|
14
|
|
|
|
|
38
|
return $keymap; |
|
261
|
|
|
|
|
|
|
}; |
|
262
|
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=head2 KeymapVicmd |
|
264
|
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
vi command-mode key bindings |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=cut |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
sub KeymapVicmd($$) { |
|
270
|
14
|
|
|
14
|
1
|
56
|
my ($fn, $keymap, $inDOS) = @_; |
|
271
|
|
|
|
|
|
|
&$fn($keymap, 'Ding', 'vicmd_keymap', |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
'C-c', 'Interrupt', |
|
274
|
|
|
|
|
|
|
'C-e', 'EmacsEditingMode', |
|
275
|
|
|
|
|
|
|
'C-h', 'ViMoveCursor', |
|
276
|
|
|
|
|
|
|
'C-l', 'ClearScreen', |
|
277
|
|
|
|
|
|
|
"\n", 'ViAcceptLine', |
|
278
|
|
|
|
|
|
|
"\r", 'ViAcceptLine', |
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
' ', 'ViMoveCursor', |
|
281
|
|
|
|
|
|
|
'#', 'SaveLine', |
|
282
|
|
|
|
|
|
|
'$', 'ViMoveCursor', |
|
283
|
|
|
|
|
|
|
'%', 'ViMoveCursor', |
|
284
|
|
|
|
|
|
|
'*', 'ViInsertPossibleCompletions', |
|
285
|
|
|
|
|
|
|
'+', 'NextHistory', |
|
286
|
|
|
|
|
|
|
',', 'ViMoveCursor', |
|
287
|
|
|
|
|
|
|
'-', 'PreviousHistory', |
|
288
|
|
|
|
|
|
|
'.', 'ViRepeatLastCommand', |
|
289
|
|
|
|
|
|
|
'/', 'ViSearch', |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
'0', 'ViMoveCursor', |
|
292
|
|
|
|
|
|
|
'1', 'ViDigit', |
|
293
|
|
|
|
|
|
|
'2', 'ViDigit', |
|
294
|
|
|
|
|
|
|
'3', 'ViDigit', |
|
295
|
|
|
|
|
|
|
'4', 'ViDigit', |
|
296
|
|
|
|
|
|
|
'5', 'ViDigit', |
|
297
|
|
|
|
|
|
|
'6', 'ViDigit', |
|
298
|
|
|
|
|
|
|
'7', 'ViDigit', |
|
299
|
|
|
|
|
|
|
'8', 'ViDigit', |
|
300
|
|
|
|
|
|
|
'9', 'ViDigit', |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
';', 'ViMoveCursor', |
|
303
|
|
|
|
|
|
|
'=', 'ViPossibleCompletions', |
|
304
|
|
|
|
|
|
|
'?', 'ViSearch', |
|
305
|
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
'A', 'ViAppendLine', |
|
307
|
|
|
|
|
|
|
'B', 'ViMoveCursor', |
|
308
|
|
|
|
|
|
|
'C', 'ViChangeLine', |
|
309
|
|
|
|
|
|
|
'D', 'ViDeleteLine', |
|
310
|
|
|
|
|
|
|
'E', 'ViMoveCursor', |
|
311
|
|
|
|
|
|
|
'F', 'ViMoveCursor', |
|
312
|
|
|
|
|
|
|
'G', 'ViHistoryLine', |
|
313
|
|
|
|
|
|
|
'H', 'PrintHistory', |
|
314
|
|
|
|
|
|
|
'I', 'ViBeginInput', |
|
315
|
|
|
|
|
|
|
'N', 'ViRepeatSearch', |
|
316
|
|
|
|
|
|
|
'P', 'ViPutBefore', |
|
317
|
|
|
|
|
|
|
'R', 'ViReplaceMode', |
|
318
|
|
|
|
|
|
|
'S', 'ViChangeEntireLine', |
|
319
|
|
|
|
|
|
|
'T', 'ViMoveCursor', |
|
320
|
|
|
|
|
|
|
'U', 'ViUndoAll', |
|
321
|
|
|
|
|
|
|
'W', 'ViMoveCursor', |
|
322
|
|
|
|
|
|
|
'X', 'ViBackwardDeleteChar', |
|
323
|
|
|
|
|
|
|
'Y', 'ViYankLine', |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
'\\', 'ViComplete', |
|
326
|
|
|
|
|
|
|
'^', 'ViMoveCursor', |
|
327
|
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
'a', 'ViAppend', |
|
329
|
|
|
|
|
|
|
'b', 'ViMoveCursor', |
|
330
|
|
|
|
|
|
|
'c', 'ViChange', |
|
331
|
|
|
|
|
|
|
'd', 'ViDelete', |
|
332
|
|
|
|
|
|
|
'e', 'ViMoveCursor', |
|
333
|
|
|
|
|
|
|
'f', 'ViMoveCursorFind', |
|
334
|
|
|
|
|
|
|
'h', 'ViMoveCursor', |
|
335
|
|
|
|
|
|
|
'i', 'ViInput', |
|
336
|
|
|
|
|
|
|
'j', 'NextHistory', |
|
337
|
|
|
|
|
|
|
'k', 'PreviousHistory', |
|
338
|
|
|
|
|
|
|
'l', 'ViMoveCursor', |
|
339
|
|
|
|
|
|
|
'n', 'ViRepeatSearch', |
|
340
|
|
|
|
|
|
|
'p', 'ViPut', |
|
341
|
|
|
|
|
|
|
'r', 'ViReplaceChar', |
|
342
|
|
|
|
|
|
|
's', 'ViChangeChar', |
|
343
|
|
|
|
|
|
|
't', 'ViMoveCursorTo', |
|
344
|
|
|
|
|
|
|
'u', 'ViUndo', |
|
345
|
|
|
|
|
|
|
'w', 'ViMoveCursor', |
|
346
|
|
|
|
|
|
|
'x', 'ViDeleteChar', |
|
347
|
|
|
|
|
|
|
'y', 'ViYank', |
|
348
|
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
'|', 'ViMoveCursor', |
|
350
|
|
|
|
|
|
|
'~', 'ViToggleCase', |
|
351
|
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
(($inDOS |
|
353
|
|
|
|
|
|
|
and (not $ENV{'TERM'} or $ENV{'TERM'} !~ /^(vt|xterm)/i)) ? |
|
354
|
|
|
|
|
|
|
( |
|
355
|
|
|
|
|
|
|
qq/"\0\110"/, 'PreviousHistory', # 72: |
|
356
|
|
|
|
|
|
|
qq/"\0\120"/, 'NextHistory', # 80: |
|
357
|
|
|
|
|
|
|
qq/"\0\113"/, 'BackwardChar', # 75: |
|
358
|
|
|
|
|
|
|
qq/"\0\115"/, 'ForwardChar', # 77: |
|
359
|
|
|
|
|
|
|
"\e", 'ViCommandMode', |
|
360
|
|
|
|
|
|
|
) : |
|
361
|
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
(('M-C-j','EmacsEditingMode'), # Conflicts with \e otherwise |
|
363
|
14
|
50
|
33
|
|
|
372
|
(($ENV{'TERM'} and $ENV{'TERM'} eq 'hpterm') ? |
|
|
|
50
|
33
|
|
|
|
|
|
364
|
|
|
|
|
|
|
( |
|
365
|
|
|
|
|
|
|
qq/"\eA"/, 'PreviousHistory', # up arrow |
|
366
|
|
|
|
|
|
|
qq/"\eB"/, 'NextHistory', # down arrow |
|
367
|
|
|
|
|
|
|
qq/"\eC"/, 'ForwardChar', # right arrow |
|
368
|
|
|
|
|
|
|
qq/"\eD"/, 'BackwardChar', # left arrow |
|
369
|
|
|
|
|
|
|
qq/"\e\\*"/, 'ViAfterEsc', |
|
370
|
|
|
|
|
|
|
) : |
|
371
|
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
# Default |
|
373
|
|
|
|
|
|
|
( |
|
374
|
|
|
|
|
|
|
qq/"\e[A"/, 'PreviousHistory', # up arrow |
|
375
|
|
|
|
|
|
|
qq/"\e[B"/, 'NextHistory', # down arrow |
|
376
|
|
|
|
|
|
|
qq/"\e[C"/, 'ForwardChar', # right arrow |
|
377
|
|
|
|
|
|
|
qq/"\e[D"/, 'BackwardChar', # left arrow |
|
378
|
|
|
|
|
|
|
qq/"\e\\*"/, 'ViAfterEsc', |
|
379
|
|
|
|
|
|
|
qq/"\e[\\*"/, 'ViAfterEsc', |
|
380
|
|
|
|
|
|
|
) |
|
381
|
|
|
|
|
|
|
))), |
|
382
|
|
|
|
|
|
|
); |
|
383
|
|
|
|
|
|
|
} |
|
384
|
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
=head2 KeymapVipos |
|
386
|
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
I positioning commands suffixed to I commands like C. |
|
388
|
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
=cut |
|
390
|
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
sub KeymapVipos($$$) { |
|
392
|
14
|
|
|
14
|
1
|
59
|
my ($fn, $keymap, $inDOS) = @_; |
|
393
|
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
&$fn($keymap, 'ViNonPosition', 'vipos_keymap', |
|
395
|
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
'^', 'ViFirstWord', |
|
397
|
|
|
|
|
|
|
'0', 'BeginningOfLine', |
|
398
|
|
|
|
|
|
|
'1', 'ViDigit', |
|
399
|
|
|
|
|
|
|
'2', 'ViDigit', |
|
400
|
|
|
|
|
|
|
'3', 'ViDigit', |
|
401
|
|
|
|
|
|
|
'4', 'ViDigit', |
|
402
|
|
|
|
|
|
|
'5', 'ViDigit', |
|
403
|
|
|
|
|
|
|
'6', 'ViDigit', |
|
404
|
|
|
|
|
|
|
'7', 'ViDigit', |
|
405
|
|
|
|
|
|
|
'8', 'ViDigit', |
|
406
|
|
|
|
|
|
|
'9', 'ViDigit', |
|
407
|
|
|
|
|
|
|
'$', 'EndOfLine', |
|
408
|
|
|
|
|
|
|
'h', 'BackwardChar', |
|
409
|
|
|
|
|
|
|
'l', 'ForwardChar', |
|
410
|
|
|
|
|
|
|
' ', 'ForwardChar', |
|
411
|
|
|
|
|
|
|
'C-h', 'BackwardChar', |
|
412
|
|
|
|
|
|
|
'f', 'ViForwardFindChar', |
|
413
|
|
|
|
|
|
|
'F', 'ViBackwardFindChar', |
|
414
|
|
|
|
|
|
|
't', 'ViForwardToChar', |
|
415
|
|
|
|
|
|
|
'T', 'ViBackwardToChar', |
|
416
|
|
|
|
|
|
|
';', 'ViRepeatFindChar', |
|
417
|
|
|
|
|
|
|
',', 'ViInverseRepeatFindChar', |
|
418
|
|
|
|
|
|
|
'%', 'ViFindMatchingParens', |
|
419
|
|
|
|
|
|
|
'|', 'ViMoveToColumn', |
|
420
|
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
# Arrow keys |
|
422
|
|
|
|
|
|
|
($inDOS ? |
|
423
|
|
|
|
|
|
|
( |
|
424
|
|
|
|
|
|
|
qq/"\0\115"/, 'ForwardChar', # 77: |
|
425
|
|
|
|
|
|
|
qq/"\0\113"/, 'BackwardChar', # 75: |
|
426
|
|
|
|
|
|
|
"\e", 'ViPositionEsc', |
|
427
|
|
|
|
|
|
|
) : |
|
428
|
|
|
|
|
|
|
|
|
429
|
14
|
50
|
33
|
|
|
253
|
($ENV{'TERM'} and $ENV{'TERM'} eq 'hpterm') ? |
|
|
|
50
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
( |
|
431
|
|
|
|
|
|
|
qq/"\eC"/, 'ForwardChar', # right arrow |
|
432
|
|
|
|
|
|
|
qq/"\eD"/, 'BackwardChar', # left arrow |
|
433
|
|
|
|
|
|
|
qq/"\e\\*"/, 'ViPositionEsc', |
|
434
|
|
|
|
|
|
|
) : |
|
435
|
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
# Default |
|
437
|
|
|
|
|
|
|
( |
|
438
|
|
|
|
|
|
|
qq/"\e[C"/, 'ForwardChar', # right arrow |
|
439
|
|
|
|
|
|
|
qq/"\e[D"/, 'BackwardChar', # left arrow |
|
440
|
|
|
|
|
|
|
qq/"\e\\*"/, 'ViPositionEsc', |
|
441
|
|
|
|
|
|
|
qq/"\e[\\*"/, 'ViPositionEsc', |
|
442
|
|
|
|
|
|
|
) |
|
443
|
|
|
|
|
|
|
), |
|
444
|
|
|
|
|
|
|
); |
|
445
|
|
|
|
|
|
|
} |
|
446
|
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
=head2 KeymapVisearch |
|
448
|
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
vi search string input mode for C> and C>. |
|
450
|
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
=cut |
|
452
|
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
sub KeymapVisearch($$) { |
|
454
|
14
|
|
|
14
|
1
|
55
|
my ($fn, $keymap) = @_; |
|
455
|
14
|
|
|
|
|
84
|
&$fn($keymap, 'SelfInsert', 'visearch_keymap', |
|
456
|
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
"\e", 'Ding', |
|
458
|
|
|
|
|
|
|
'C-c', 'Interrupt', |
|
459
|
|
|
|
|
|
|
'C-h', 'ViSearchBackwardDeleteChar', |
|
460
|
|
|
|
|
|
|
'C-w', 'UnixWordRubout', |
|
461
|
|
|
|
|
|
|
'C-u', 'UnixLineDiscard', |
|
462
|
|
|
|
|
|
|
'C-v', 'QuotedInsert', |
|
463
|
|
|
|
|
|
|
'DEL', 'ViSearchBackwardDeleteChar', |
|
464
|
|
|
|
|
|
|
"\n", 'ViEndSearch', |
|
465
|
|
|
|
|
|
|
"\r", 'ViEndSearch', |
|
466
|
|
|
|
|
|
|
); |
|
467
|
|
|
|
|
|
|
} |
|
468
|
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
470
|
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
L |
|
472
|
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
=cut |
|
474
|
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
1; |