xref: /dflybsd-src/contrib/nvi2/vi/v_cmd.c (revision 07bc39c2f4bbca56f12568e06d89da17f2eeb965)
1*e0b8e63eSJohn Marino /*-
2*e0b8e63eSJohn Marino  * Copyright (c) 1992, 1993, 1994
3*e0b8e63eSJohn Marino  *	The Regents of the University of California.  All rights reserved.
4*e0b8e63eSJohn Marino  * Copyright (c) 1992, 1993, 1994, 1995, 1996
5*e0b8e63eSJohn Marino  *	Keith Bostic.  All rights reserved.
6*e0b8e63eSJohn Marino  *
7*e0b8e63eSJohn Marino  * See the LICENSE file for redistribution information.
8*e0b8e63eSJohn Marino  */
9*e0b8e63eSJohn Marino 
10*e0b8e63eSJohn Marino #include "config.h"
11*e0b8e63eSJohn Marino 
12*e0b8e63eSJohn Marino #include <sys/types.h>
13*e0b8e63eSJohn Marino #include <sys/queue.h>
14*e0b8e63eSJohn Marino #include <sys/time.h>
15*e0b8e63eSJohn Marino 
16*e0b8e63eSJohn Marino #include <bitstring.h>
17*e0b8e63eSJohn Marino #include <limits.h>
18*e0b8e63eSJohn Marino #include <stdio.h>
19*e0b8e63eSJohn Marino 
20*e0b8e63eSJohn Marino #include "../common/common.h"
21*e0b8e63eSJohn Marino #include "vi.h"
22*e0b8e63eSJohn Marino 
23*e0b8e63eSJohn Marino /*
24*e0b8e63eSJohn Marino  * This array maps keystrokes to vi command functions.  It is known
25*e0b8e63eSJohn Marino  * in ex/ex_usage.c that it takes four columns to name a vi character.
26*e0b8e63eSJohn Marino  */
27*e0b8e63eSJohn Marino VIKEYS const vikeys [MAXVIKEY + 1] = {
28*e0b8e63eSJohn Marino /* 000 NUL -- The code in vi.c expects key 0 to be undefined. */
29*e0b8e63eSJohn Marino 	{NULL},
30*e0b8e63eSJohn Marino /* 001  ^A */
31*e0b8e63eSJohn Marino 	{v_searchw,	V_ABS|V_CNT|V_MOVE|V_KEYW|VM_CUTREQ|VM_RCM_SET,
32*e0b8e63eSJohn Marino 	    "[count]^A",
33*e0b8e63eSJohn Marino 	    "^A search forward for cursor word"},
34*e0b8e63eSJohn Marino /* 002  ^B */
35*e0b8e63eSJohn Marino 	{v_pageup,	V_CNT|VM_RCM_SET,
36*e0b8e63eSJohn Marino 	    "[count]^B",
37*e0b8e63eSJohn Marino 	    "^B scroll up by screens"},
38*e0b8e63eSJohn Marino /* 003  ^C */
39*e0b8e63eSJohn Marino 	{NULL,		0,
40*e0b8e63eSJohn Marino 	    "^C",
41*e0b8e63eSJohn Marino 	    "^C interrupt an operation (e.g. read, write, search)"},
42*e0b8e63eSJohn Marino /* 004  ^D */
43*e0b8e63eSJohn Marino 	{v_hpagedown,	V_CNT|VM_RCM_SET,
44*e0b8e63eSJohn Marino 	    "[count]^D",
45*e0b8e63eSJohn Marino 	    "^D scroll down by half screens (setting count)"},
46*e0b8e63eSJohn Marino /* 005  ^E */
47*e0b8e63eSJohn Marino 	{v_linedown,	V_CNT,
48*e0b8e63eSJohn Marino 	    "[count]^E",
49*e0b8e63eSJohn Marino 	    "^E scroll down by lines"},
50*e0b8e63eSJohn Marino /* 006  ^F */
51*e0b8e63eSJohn Marino 	{v_pagedown,	V_CNT|VM_RCM_SET,
52*e0b8e63eSJohn Marino 	    "[count]^F",
53*e0b8e63eSJohn Marino 	    "^F scroll down by screens"},
54*e0b8e63eSJohn Marino /* 007  ^G */
55*e0b8e63eSJohn Marino 	{v_status,	0,
56*e0b8e63eSJohn Marino 	    "^G",
57*e0b8e63eSJohn Marino 	    "^G file status"},
58*e0b8e63eSJohn Marino /* 010  ^H */
59*e0b8e63eSJohn Marino 	{v_left,	V_CNT|V_MOVE|VM_RCM_SET,
60*e0b8e63eSJohn Marino 	    "[count]^H",
61*e0b8e63eSJohn Marino 	    "^H move left by characters"},
62*e0b8e63eSJohn Marino /* 011  ^I */
63*e0b8e63eSJohn Marino 	{NULL},
64*e0b8e63eSJohn Marino /* 012  ^J */
65*e0b8e63eSJohn Marino 	{v_down,	V_CNT|V_MOVE|VM_LMODE|VM_RCM,
66*e0b8e63eSJohn Marino 	    "[count]^J",
67*e0b8e63eSJohn Marino 	    "^J move down by lines"},
68*e0b8e63eSJohn Marino /* 013  ^K */
69*e0b8e63eSJohn Marino 	{NULL},
70*e0b8e63eSJohn Marino /* 014  ^L */
71*e0b8e63eSJohn Marino 	{v_redraw,	0,
72*e0b8e63eSJohn Marino 	    "^L",
73*e0b8e63eSJohn Marino 	    "^L redraw screen"},
74*e0b8e63eSJohn Marino /* 015  ^M */
75*e0b8e63eSJohn Marino 	{v_cr,		V_CNT|V_MOVE|VM_LMODE|VM_RCM_SETFNB,
76*e0b8e63eSJohn Marino 	    "[count]^M",
77*e0b8e63eSJohn Marino 	    "^M move down by lines (to first non-blank)"},
78*e0b8e63eSJohn Marino /* 016  ^N */
79*e0b8e63eSJohn Marino 	{v_down,	V_CNT|V_MOVE|VM_LMODE|VM_RCM,
80*e0b8e63eSJohn Marino 	    "[count]^N",
81*e0b8e63eSJohn Marino 	    "^N move down by lines"},
82*e0b8e63eSJohn Marino /* 017  ^O */
83*e0b8e63eSJohn Marino 	{NULL},
84*e0b8e63eSJohn Marino /* 020  ^P */
85*e0b8e63eSJohn Marino 	{v_up,		V_CNT|V_MOVE|VM_LMODE|VM_RCM,
86*e0b8e63eSJohn Marino 	    "[count]^P",
87*e0b8e63eSJohn Marino 	    "^P move up by lines"},
88*e0b8e63eSJohn Marino /* 021  ^Q -- same as ^V if not used for hardware flow control. */
89*e0b8e63eSJohn Marino 	{NULL},
90*e0b8e63eSJohn Marino /* 022  ^R */
91*e0b8e63eSJohn Marino 	{v_redraw,	0,
92*e0b8e63eSJohn Marino 	    "^R",
93*e0b8e63eSJohn Marino 	    "^R redraw screen"},
94*e0b8e63eSJohn Marino /* 023  ^S -- not available, used for hardware flow control. */
95*e0b8e63eSJohn Marino 	{NULL},
96*e0b8e63eSJohn Marino /* 024  ^T */
97*e0b8e63eSJohn Marino 	{v_tagpop,	V_ABS|VM_RCM_SET,
98*e0b8e63eSJohn Marino 	    "^T",
99*e0b8e63eSJohn Marino 	    "^T tag pop"},
100*e0b8e63eSJohn Marino /* 025  ^U */
101*e0b8e63eSJohn Marino 	{v_hpageup,	V_CNT|VM_RCM_SET,
102*e0b8e63eSJohn Marino 	    "[count]^U",
103*e0b8e63eSJohn Marino 	    "^U half page up (set count)"},
104*e0b8e63eSJohn Marino /* 026  ^V */
105*e0b8e63eSJohn Marino 	{NULL,		0,
106*e0b8e63eSJohn Marino 	    "^V",
107*e0b8e63eSJohn Marino 	    "^V input a literal character"},
108*e0b8e63eSJohn Marino /* 027  ^W */
109*e0b8e63eSJohn Marino 	{v_screen,	0,
110*e0b8e63eSJohn Marino 	    "^W",
111*e0b8e63eSJohn Marino 	    "^W move to next screen"},
112*e0b8e63eSJohn Marino /* 030  ^X */
113*e0b8e63eSJohn Marino 	{NULL},
114*e0b8e63eSJohn Marino /* 031  ^Y */
115*e0b8e63eSJohn Marino 	{v_lineup,	V_CNT,
116*e0b8e63eSJohn Marino 	    "[count]^Y",
117*e0b8e63eSJohn Marino 	    "^Y page up by lines"},
118*e0b8e63eSJohn Marino /* 032  ^Z */
119*e0b8e63eSJohn Marino 	{v_suspend,	V_SECURE,
120*e0b8e63eSJohn Marino 	    "^Z",
121*e0b8e63eSJohn Marino 	    "^Z suspend editor"},
122*e0b8e63eSJohn Marino /* 033  ^[ */
123*e0b8e63eSJohn Marino 	{NULL,		0,
124*e0b8e63eSJohn Marino 	    "^[ <escape>",
125*e0b8e63eSJohn Marino 	    "^[ <escape> exit input mode, cancel partial commands"},
126*e0b8e63eSJohn Marino /* 034  ^\ */
127*e0b8e63eSJohn Marino 	{v_exmode,	0,
128*e0b8e63eSJohn Marino 	    "^\\",
129*e0b8e63eSJohn Marino 	    "^\\ switch to ex mode"},
130*e0b8e63eSJohn Marino /* 035  ^] */
131*e0b8e63eSJohn Marino 	{v_tagpush,	V_ABS|V_KEYW|VM_RCM_SET,
132*e0b8e63eSJohn Marino 	    "^]",
133*e0b8e63eSJohn Marino 	    "^] tag push cursor word"},
134*e0b8e63eSJohn Marino /* 036  ^^ */
135*e0b8e63eSJohn Marino 	{v_switch,	0,
136*e0b8e63eSJohn Marino 	    "^^",
137*e0b8e63eSJohn Marino 	    "^^ switch to previous file"},
138*e0b8e63eSJohn Marino /* 037  ^_ */
139*e0b8e63eSJohn Marino 	{NULL},
140*e0b8e63eSJohn Marino /* 040 ' ' */
141*e0b8e63eSJohn Marino 	{v_right,	V_CNT|V_MOVE|VM_RCM_SET,
142*e0b8e63eSJohn Marino 	    "[count]' '",
143*e0b8e63eSJohn Marino 	    "   <space> move right by columns"},
144*e0b8e63eSJohn Marino /* 041   ! */
145*e0b8e63eSJohn Marino 	{v_filter,	V_CNT|V_DOT|V_MOTION|V_SECURE|VM_RCM_SET,
146*e0b8e63eSJohn Marino 	    "[count]![count]motion command(s)",
147*e0b8e63eSJohn Marino 	    " ! filter through command(s) to motion"},
148*e0b8e63eSJohn Marino /* 042   " */
149*e0b8e63eSJohn Marino 	{NULL},
150*e0b8e63eSJohn Marino /* 043   # */
151*e0b8e63eSJohn Marino 	{v_increment,	V_CHAR|V_CNT|V_DOT|VM_RCM_SET,
152*e0b8e63eSJohn Marino 	    "[count]# +|-|#",
153*e0b8e63eSJohn Marino 	    " # number increment/decrement"},
154*e0b8e63eSJohn Marino /* 044   $ */
155*e0b8e63eSJohn Marino 	{v_dollar,	V_CNT|V_MOVE|VM_RCM_SETLAST,
156*e0b8e63eSJohn Marino 	    " [count]$",
157*e0b8e63eSJohn Marino 	    " $ move to last column"},
158*e0b8e63eSJohn Marino /* 045   % */
159*e0b8e63eSJohn Marino 	{v_match,	V_ABS|V_CNT|V_MOVE|VM_CUTREQ|VM_RCM_SET,
160*e0b8e63eSJohn Marino 	    "%",
161*e0b8e63eSJohn Marino 	    " % move to match"},
162*e0b8e63eSJohn Marino /* 046   & */
163*e0b8e63eSJohn Marino 	{v_again,	0,
164*e0b8e63eSJohn Marino 	    "&",
165*e0b8e63eSJohn Marino 	    " & repeat substitution"},
166*e0b8e63eSJohn Marino /* 047   ' */
167*e0b8e63eSJohn Marino 	{v_fmark,	V_ABS_L|V_CHAR|V_MOVE|VM_LMODE|VM_RCM_SET,
168*e0b8e63eSJohn Marino 	    "'['a-z]",
169*e0b8e63eSJohn Marino 	    " ' move to mark (to first non-blank)"},
170*e0b8e63eSJohn Marino /* 050   ( */
171*e0b8e63eSJohn Marino 	{v_sentenceb,	V_ABS|V_CNT|V_MOVE|VM_CUTREQ|VM_RCM_SET,
172*e0b8e63eSJohn Marino 	    "[count](",
173*e0b8e63eSJohn Marino 	    " ( move back sentence"},
174*e0b8e63eSJohn Marino /* 051   ) */
175*e0b8e63eSJohn Marino 	{v_sentencef,	V_ABS|V_CNT|V_MOVE|VM_CUTREQ|VM_RCM_SET,
176*e0b8e63eSJohn Marino 	    "[count])",
177*e0b8e63eSJohn Marino 	    " ) move forward sentence"},
178*e0b8e63eSJohn Marino /* 052   * */
179*e0b8e63eSJohn Marino 	{NULL},
180*e0b8e63eSJohn Marino /* 053   + */
181*e0b8e63eSJohn Marino 	{v_down,	V_CNT|V_MOVE|VM_LMODE|VM_RCM_SETFNB,
182*e0b8e63eSJohn Marino 	    "[count]+",
183*e0b8e63eSJohn Marino 	    " + move down by lines (to first non-blank)"},
184*e0b8e63eSJohn Marino /* 054   , */
185*e0b8e63eSJohn Marino 	{v_chrrepeat,	V_CNT|V_MOVE|VM_RCM_SET,
186*e0b8e63eSJohn Marino 	    "[count],",
187*e0b8e63eSJohn Marino 	    " , reverse last F, f, T or t search"},
188*e0b8e63eSJohn Marino /* 055   - */
189*e0b8e63eSJohn Marino 	{v_up,		V_CNT|V_MOVE|VM_LMODE|VM_RCM_SETFNB,
190*e0b8e63eSJohn Marino 	    "[count]-",
191*e0b8e63eSJohn Marino 	    " - move up by lines (to first non-blank)"},
192*e0b8e63eSJohn Marino /* 056   . */
193*e0b8e63eSJohn Marino 	{NULL,		0,
194*e0b8e63eSJohn Marino 	    ".",
195*e0b8e63eSJohn Marino 	    " . repeat the last command"},
196*e0b8e63eSJohn Marino /* 057   / */
197*e0b8e63eSJohn Marino 	{v_searchf,	V_ABS_C|V_MOVE|VM_CUTREQ|VM_RCM_SET,
198*e0b8e63eSJohn Marino 	    "/RE[/ offset]",
199*e0b8e63eSJohn Marino 	    " / search forward"},
200*e0b8e63eSJohn Marino /* 060   0 */
201*e0b8e63eSJohn Marino 	{v_zero,	V_MOVE|VM_RCM_SET,
202*e0b8e63eSJohn Marino 	    "0",
203*e0b8e63eSJohn Marino 	    " 0 move to first character"},
204*e0b8e63eSJohn Marino /* 061   1 */
205*e0b8e63eSJohn Marino 	{NULL},
206*e0b8e63eSJohn Marino /* 062   2 */
207*e0b8e63eSJohn Marino 	{NULL},
208*e0b8e63eSJohn Marino /* 063   3 */
209*e0b8e63eSJohn Marino 	{NULL},
210*e0b8e63eSJohn Marino /* 064   4 */
211*e0b8e63eSJohn Marino 	{NULL},
212*e0b8e63eSJohn Marino /* 065   5 */
213*e0b8e63eSJohn Marino 	{NULL},
214*e0b8e63eSJohn Marino /* 066   6 */
215*e0b8e63eSJohn Marino 	{NULL},
216*e0b8e63eSJohn Marino /* 067   7 */
217*e0b8e63eSJohn Marino 	{NULL},
218*e0b8e63eSJohn Marino /* 070   8 */
219*e0b8e63eSJohn Marino 	{NULL},
220*e0b8e63eSJohn Marino /* 071   9 */
221*e0b8e63eSJohn Marino 	{NULL},
222*e0b8e63eSJohn Marino /* 072   : */
223*e0b8e63eSJohn Marino 	{v_ex,		0,
224*e0b8e63eSJohn Marino 	    ":command [| command] ...",
225*e0b8e63eSJohn Marino 	    " : ex command"},
226*e0b8e63eSJohn Marino /* 073   ; */
227*e0b8e63eSJohn Marino 	{v_chrepeat,	V_CNT|V_MOVE|VM_RCM_SET,
228*e0b8e63eSJohn Marino 	    "[count];",
229*e0b8e63eSJohn Marino 	    " ; repeat last F, f, T or t search"},
230*e0b8e63eSJohn Marino /* 074   < */
231*e0b8e63eSJohn Marino 	{v_shiftl,	V_CNT|V_DOT|V_MOTION|VM_RCM_SET,
232*e0b8e63eSJohn Marino 	    "[count]<[count]motion",
233*e0b8e63eSJohn Marino 	    " < shift lines left to motion"},
234*e0b8e63eSJohn Marino /* 075   = */
235*e0b8e63eSJohn Marino 	{NULL},
236*e0b8e63eSJohn Marino /* 076   > */
237*e0b8e63eSJohn Marino 	{v_shiftr,	V_CNT|V_DOT|V_MOTION|VM_RCM_SET,
238*e0b8e63eSJohn Marino 	    "[count]>[count]motion",
239*e0b8e63eSJohn Marino 	    " > shift lines right to motion"},
240*e0b8e63eSJohn Marino /* 077   ? */
241*e0b8e63eSJohn Marino 	{v_searchb,	V_ABS_C|V_MOVE|VM_CUTREQ|VM_RCM_SET,
242*e0b8e63eSJohn Marino 	    "?RE[? offset]",
243*e0b8e63eSJohn Marino 	    " ? search backward"},
244*e0b8e63eSJohn Marino /* 100   @ */
245*e0b8e63eSJohn Marino 	{v_at,		V_CNT|V_RBUF|VM_RCM_SET,
246*e0b8e63eSJohn Marino 	    "@buffer",
247*e0b8e63eSJohn Marino 	    " @ execute buffer"},
248*e0b8e63eSJohn Marino /* 101   A */
249*e0b8e63eSJohn Marino 	{v_iA,		V_CNT|V_DOT|VM_RCM_SET,
250*e0b8e63eSJohn Marino 	    "[count]A",
251*e0b8e63eSJohn Marino 	    " A append to the line"},
252*e0b8e63eSJohn Marino /* 102   B */
253*e0b8e63eSJohn Marino 	{v_wordB,	V_CNT|V_MOVE|VM_RCM_SET,
254*e0b8e63eSJohn Marino 	    "[count]B",
255*e0b8e63eSJohn Marino 	    " B move back bigword"},
256*e0b8e63eSJohn Marino /* 103   C */
257*e0b8e63eSJohn Marino 	{NULL,		0,
258*e0b8e63eSJohn Marino 	    "[buffer][count]C",
259*e0b8e63eSJohn Marino 	    " C change to end-of-line"},
260*e0b8e63eSJohn Marino /* 104   D */
261*e0b8e63eSJohn Marino 	{NULL,		0,
262*e0b8e63eSJohn Marino 	    "[buffer]D",
263*e0b8e63eSJohn Marino 	    " D delete to end-of-line"},
264*e0b8e63eSJohn Marino /* 105   E */
265*e0b8e63eSJohn Marino 	{v_wordE,	V_CNT|V_MOVE|VM_RCM_SET,
266*e0b8e63eSJohn Marino 	    "[count]E",
267*e0b8e63eSJohn Marino 	    " E move to end of bigword"},
268*e0b8e63eSJohn Marino /* 106   F */
269*e0b8e63eSJohn Marino 	{v_chF,		V_CHAR|V_CNT|V_MOVE|VM_RCM_SET,
270*e0b8e63eSJohn Marino 	    "[count]F character",
271*e0b8e63eSJohn Marino 	    " F character in line backward search"},
272*e0b8e63eSJohn Marino /* 107   G */
273*e0b8e63eSJohn Marino 	{v_lgoto,	V_ABS_L|V_CNT|V_MOVE|VM_LMODE|VM_RCM_SETFNB,
274*e0b8e63eSJohn Marino 	    "[count]G",
275*e0b8e63eSJohn Marino 	    " G move to line"},
276*e0b8e63eSJohn Marino /* 110   H */
277*e0b8e63eSJohn Marino 	{v_home,	V_ABS_L|V_CNT|V_MOVE|VM_LMODE|VM_RCM_SETNNB,
278*e0b8e63eSJohn Marino 	    "[count]H",
279*e0b8e63eSJohn Marino 	    " H move to count lines from screen top"},
280*e0b8e63eSJohn Marino /* 111   I */
281*e0b8e63eSJohn Marino 	{v_iI,		V_CNT|V_DOT|VM_RCM_SET,
282*e0b8e63eSJohn Marino 	    "[count]I",
283*e0b8e63eSJohn Marino 	    " I insert before first nonblank"},
284*e0b8e63eSJohn Marino /* 112   J */
285*e0b8e63eSJohn Marino 	{v_join,	V_CNT|V_DOT|VM_RCM_SET,
286*e0b8e63eSJohn Marino 	    "[count]J",
287*e0b8e63eSJohn Marino 	    " J join lines"},
288*e0b8e63eSJohn Marino /* 113   K */
289*e0b8e63eSJohn Marino 	{NULL},
290*e0b8e63eSJohn Marino /* 114   L */
291*e0b8e63eSJohn Marino 	{v_bottom,	V_ABS_L|V_CNT|V_MOVE|VM_LMODE|VM_RCM_SETNNB,
292*e0b8e63eSJohn Marino 	    "[count]L",
293*e0b8e63eSJohn Marino 	    " L move to screen bottom"},
294*e0b8e63eSJohn Marino /* 115   M */
295*e0b8e63eSJohn Marino 	{v_middle,	V_ABS_L|V_CNT|V_MOVE|VM_LMODE|VM_RCM_SETNNB,
296*e0b8e63eSJohn Marino 	    "M",
297*e0b8e63eSJohn Marino 	    " M move to screen middle"},
298*e0b8e63eSJohn Marino /* 116   N */
299*e0b8e63eSJohn Marino 	{v_searchN,	V_ABS_C|V_MOVE|VM_CUTREQ|VM_RCM_SET,
300*e0b8e63eSJohn Marino 	    "n",
301*e0b8e63eSJohn Marino 	    " N reverse last search"},
302*e0b8e63eSJohn Marino /* 117   O */
303*e0b8e63eSJohn Marino 	{v_iO,		V_CNT|V_DOT|VM_RCM_SET,
304*e0b8e63eSJohn Marino 	    "[count]O",
305*e0b8e63eSJohn Marino 	    " O insert above line"},
306*e0b8e63eSJohn Marino /* 120   P */
307*e0b8e63eSJohn Marino 	{v_Put,		V_CNT|V_DOT|V_OBUF|VM_RCM_SET,
308*e0b8e63eSJohn Marino 	    "[buffer]P",
309*e0b8e63eSJohn Marino 	    " P insert before cursor from buffer"},
310*e0b8e63eSJohn Marino /* 121   Q */
311*e0b8e63eSJohn Marino 	{v_exmode,	0,
312*e0b8e63eSJohn Marino 	    "Q",
313*e0b8e63eSJohn Marino 	    " Q switch to ex mode"},
314*e0b8e63eSJohn Marino /* 122   R */
315*e0b8e63eSJohn Marino 	{v_Replace,	V_CNT|V_DOT|VM_RCM_SET,
316*e0b8e63eSJohn Marino 	    "[count]R",
317*e0b8e63eSJohn Marino 	    " R replace characters"},
318*e0b8e63eSJohn Marino /* 123   S */
319*e0b8e63eSJohn Marino 	{NULL,		0,
320*e0b8e63eSJohn Marino 	    "[buffer][count]S",
321*e0b8e63eSJohn Marino 	    " S substitute for the line(s)"},
322*e0b8e63eSJohn Marino /* 124   T */
323*e0b8e63eSJohn Marino 	{v_chT,		V_CHAR|V_CNT|V_MOVE|VM_RCM_SET,
324*e0b8e63eSJohn Marino 	    "[count]T character",
325*e0b8e63eSJohn Marino 	    " T before character in line backward search"},
326*e0b8e63eSJohn Marino /* 125   U */
327*e0b8e63eSJohn Marino 	{v_Undo,	VM_RCM_SET,
328*e0b8e63eSJohn Marino 	    "U",
329*e0b8e63eSJohn Marino 	    " U Restore the current line"},
330*e0b8e63eSJohn Marino /* 126   V */
331*e0b8e63eSJohn Marino 	{NULL},
332*e0b8e63eSJohn Marino /* 127   W */
333*e0b8e63eSJohn Marino 	{v_wordW,	V_CNT|V_MOVE|VM_RCM_SET,
334*e0b8e63eSJohn Marino 	    "[count]W",
335*e0b8e63eSJohn Marino 	    " W move to next bigword"},
336*e0b8e63eSJohn Marino /* 130   X */
337*e0b8e63eSJohn Marino 	{v_Xchar,	V_CNT|V_DOT|V_OBUF|VM_RCM_SET,
338*e0b8e63eSJohn Marino 	    "[buffer][count]X",
339*e0b8e63eSJohn Marino 	    " X delete character before cursor"},
340*e0b8e63eSJohn Marino /* 131   Y */
341*e0b8e63eSJohn Marino 	{NULL,		0,
342*e0b8e63eSJohn Marino 	    "[buffer][count]Y",
343*e0b8e63eSJohn Marino 	    " Y copy line"},
344*e0b8e63eSJohn Marino /* 132   Z */
345*e0b8e63eSJohn Marino 	{v_zexit,	0,
346*e0b8e63eSJohn Marino 	    "ZZ",
347*e0b8e63eSJohn Marino 	    "ZZ save file and exit"},
348*e0b8e63eSJohn Marino /* 133   [ */
349*e0b8e63eSJohn Marino 	{v_sectionb,	V_ABS|V_CNT|V_MOVE|VM_RCM_SET,
350*e0b8e63eSJohn Marino 	    "[[",
351*e0b8e63eSJohn Marino 	    "[[ move back section"},
352*e0b8e63eSJohn Marino /* 134   \ */
353*e0b8e63eSJohn Marino 	{NULL},
354*e0b8e63eSJohn Marino /* 135   ] */
355*e0b8e63eSJohn Marino 	{v_sectionf,	V_ABS|V_CNT|V_MOVE|VM_RCM_SET,
356*e0b8e63eSJohn Marino 	    "]]",
357*e0b8e63eSJohn Marino 	    "]] move forward section"},
358*e0b8e63eSJohn Marino /* 136   ^ */
359*e0b8e63eSJohn Marino 	/*
360*e0b8e63eSJohn Marino 	 * DON'T set the VM_RCM_SETFNB flag, the function has to do the work
361*e0b8e63eSJohn Marino 	 * anyway, in case it's a motion component.  DO set VM_RCM_SET, so
362*e0b8e63eSJohn Marino 	 * that any motion that's part of a command is preserved.
363*e0b8e63eSJohn Marino 	 */
364*e0b8e63eSJohn Marino 	{v_first,	V_CNT|V_MOVE|VM_RCM_SET,
365*e0b8e63eSJohn Marino 	    "^",
366*e0b8e63eSJohn Marino 	    " ^ move to first non-blank"},
367*e0b8e63eSJohn Marino /* 137   _ */
368*e0b8e63eSJohn Marino 	/*
369*e0b8e63eSJohn Marino 	 * Needs both to set the VM_RCM_SETFNB flag, and to do the work
370*e0b8e63eSJohn Marino 	 * in the function, in case it's a delete.
371*e0b8e63eSJohn Marino 	 */
372*e0b8e63eSJohn Marino 	{v_cfirst,	V_CNT|V_MOVE|VM_RCM_SETFNB,
373*e0b8e63eSJohn Marino 	    "_",
374*e0b8e63eSJohn Marino 	    " _ move to first non-blank"},
375*e0b8e63eSJohn Marino /* 140   ` */
376*e0b8e63eSJohn Marino 	{v_bmark,	V_ABS_C|V_CHAR|V_MOVE|VM_CUTREQ|VM_RCM_SET,
377*e0b8e63eSJohn Marino 	    "`[`a-z]",
378*e0b8e63eSJohn Marino 	    " ` move to mark"},
379*e0b8e63eSJohn Marino /* 141   a */
380*e0b8e63eSJohn Marino 	{v_ia,		V_CNT|V_DOT|VM_RCM_SET,
381*e0b8e63eSJohn Marino 	    "[count]a",
382*e0b8e63eSJohn Marino 	    " a append after cursor"},
383*e0b8e63eSJohn Marino /* 142   b */
384*e0b8e63eSJohn Marino 	{v_wordb,	V_CNT|V_MOVE|VM_RCM_SET,
385*e0b8e63eSJohn Marino 	    "[count]b",
386*e0b8e63eSJohn Marino 	    " b move back word"},
387*e0b8e63eSJohn Marino /* 143   c */
388*e0b8e63eSJohn Marino 	{v_change,	V_CNT|V_DOT|V_MOTION|V_OBUF|VM_RCM_SET,
389*e0b8e63eSJohn Marino 	    "[buffer][count]c[count]motion",
390*e0b8e63eSJohn Marino 	    " c change to motion"},
391*e0b8e63eSJohn Marino /* 144   d */
392*e0b8e63eSJohn Marino 	{v_delete,	V_CNT|V_DOT|V_MOTION|V_OBUF|VM_RCM_SET,
393*e0b8e63eSJohn Marino 	    "[buffer][count]d[count]motion",
394*e0b8e63eSJohn Marino 	    " d delete to motion"},
395*e0b8e63eSJohn Marino /* 145   e */
396*e0b8e63eSJohn Marino 	{v_worde,	V_CNT|V_MOVE|VM_RCM_SET,
397*e0b8e63eSJohn Marino 	    "[count]e",
398*e0b8e63eSJohn Marino 	    " e move to end of word"},
399*e0b8e63eSJohn Marino /* 146   f */
400*e0b8e63eSJohn Marino 	{v_chf,		V_CHAR|V_CNT|V_MOVE|VM_RCM_SET,
401*e0b8e63eSJohn Marino 	    "[count]f character",
402*e0b8e63eSJohn Marino 	    " f character in line forward search"},
403*e0b8e63eSJohn Marino /* 147   g */
404*e0b8e63eSJohn Marino 	{NULL},
405*e0b8e63eSJohn Marino /* 150   h */
406*e0b8e63eSJohn Marino 	{v_left,	V_CNT|V_MOVE|VM_RCM_SET,
407*e0b8e63eSJohn Marino 	    "[count]h",
408*e0b8e63eSJohn Marino 	    " h move left by columns"},
409*e0b8e63eSJohn Marino /* 151   i */
410*e0b8e63eSJohn Marino 	{v_ii,		V_CNT|V_DOT|VM_RCM_SET,
411*e0b8e63eSJohn Marino 	    "[count]i",
412*e0b8e63eSJohn Marino 	    " i insert before cursor"},
413*e0b8e63eSJohn Marino /* 152   j */
414*e0b8e63eSJohn Marino 	{v_down,	V_CNT|V_MOVE|VM_LMODE|VM_RCM,
415*e0b8e63eSJohn Marino 	    "[count]j",
416*e0b8e63eSJohn Marino 	    " j move down by lines"},
417*e0b8e63eSJohn Marino /* 153   k */
418*e0b8e63eSJohn Marino 	{v_up,		V_CNT|V_MOVE|VM_LMODE|VM_RCM,
419*e0b8e63eSJohn Marino 	    "[count]k",
420*e0b8e63eSJohn Marino 	    " k move up by lines"},
421*e0b8e63eSJohn Marino /* 154   l */
422*e0b8e63eSJohn Marino 	{v_right,	V_CNT|V_MOVE|VM_RCM_SET,
423*e0b8e63eSJohn Marino 	    "[count]l",
424*e0b8e63eSJohn Marino 	    " l move right by columns"},
425*e0b8e63eSJohn Marino /* 155   m */
426*e0b8e63eSJohn Marino 	{v_mark,	V_CHAR,
427*e0b8e63eSJohn Marino 	    "m[a-z]",
428*e0b8e63eSJohn Marino 	    " m set mark"},
429*e0b8e63eSJohn Marino /* 156   n */
430*e0b8e63eSJohn Marino 	{v_searchn,	V_ABS_C|V_MOVE|VM_CUTREQ|VM_RCM_SET,
431*e0b8e63eSJohn Marino 	    "n",
432*e0b8e63eSJohn Marino 	    " n repeat last search"},
433*e0b8e63eSJohn Marino /* 157   o */
434*e0b8e63eSJohn Marino 	{v_io,		V_CNT|V_DOT|VM_RCM_SET,
435*e0b8e63eSJohn Marino 	    "[count]o",
436*e0b8e63eSJohn Marino 	    " o append after line"},
437*e0b8e63eSJohn Marino /* 160   p */
438*e0b8e63eSJohn Marino 	{v_put,		V_CNT|V_DOT|V_OBUF|VM_RCM_SET,
439*e0b8e63eSJohn Marino 	    "[buffer]p",
440*e0b8e63eSJohn Marino 	    " p insert after cursor from buffer"},
441*e0b8e63eSJohn Marino /* 161   q */
442*e0b8e63eSJohn Marino 	{NULL},
443*e0b8e63eSJohn Marino /* 162   r */
444*e0b8e63eSJohn Marino 	{v_replace,	V_CNT|V_DOT|VM_RCM_SET,
445*e0b8e63eSJohn Marino 	    "[count]r character",
446*e0b8e63eSJohn Marino 	    " r replace character"},
447*e0b8e63eSJohn Marino /* 163   s */
448*e0b8e63eSJohn Marino 	{v_subst,	V_CNT|V_DOT|V_OBUF|VM_RCM_SET,
449*e0b8e63eSJohn Marino 	    "[buffer][count]s",
450*e0b8e63eSJohn Marino 	    " s substitute character"},
451*e0b8e63eSJohn Marino /* 164   t */
452*e0b8e63eSJohn Marino 	{v_cht,		V_CHAR|V_CNT|V_MOVE|VM_RCM_SET,
453*e0b8e63eSJohn Marino 	    "[count]t character",
454*e0b8e63eSJohn Marino 	    " t before character in line forward search"},
455*e0b8e63eSJohn Marino /* 165   u */
456*e0b8e63eSJohn Marino 	/*
457*e0b8e63eSJohn Marino 	 * DON'T set the V_DOT flag, it' more complicated than that.
458*e0b8e63eSJohn Marino 	 * See vi/vi.c for details.
459*e0b8e63eSJohn Marino 	 */
460*e0b8e63eSJohn Marino 	{v_undo,	VM_RCM_SET,
461*e0b8e63eSJohn Marino 	    "u",
462*e0b8e63eSJohn Marino 	    " u undo last change"},
463*e0b8e63eSJohn Marino /* 166   v */
464*e0b8e63eSJohn Marino 	{NULL},
465*e0b8e63eSJohn Marino /* 167   w */
466*e0b8e63eSJohn Marino 	{v_wordw,	V_CNT|V_MOVE|VM_RCM_SET,
467*e0b8e63eSJohn Marino 	    "[count]w",
468*e0b8e63eSJohn Marino 	    " w move to next word"},
469*e0b8e63eSJohn Marino /* 170   x */
470*e0b8e63eSJohn Marino 	{v_xchar,	V_CNT|V_DOT|V_OBUF|VM_RCM_SET,
471*e0b8e63eSJohn Marino 	    "[buffer][count]x",
472*e0b8e63eSJohn Marino 	    " x delete character"},
473*e0b8e63eSJohn Marino /* 171   y */
474*e0b8e63eSJohn Marino 	{v_yank,	V_CNT|V_DOT|V_MOTION|V_OBUF|VM_RCM_SET,
475*e0b8e63eSJohn Marino 	    "[buffer][count]y[count]motion",
476*e0b8e63eSJohn Marino 	    " y copy text to motion into a cut buffer"},
477*e0b8e63eSJohn Marino /* 172   z */
478*e0b8e63eSJohn Marino 	/*
479*e0b8e63eSJohn Marino 	 * DON'T set the V_CHAR flag, the char isn't required,
480*e0b8e63eSJohn Marino 	 * so it's handled specially in getcmd().
481*e0b8e63eSJohn Marino 	 */
482*e0b8e63eSJohn Marino 	{v_z, 		V_ABS_L|V_CNT|VM_RCM_SETFNB,
483*e0b8e63eSJohn Marino 	    "[line]z[window_size][-|.|+|^|<CR>]",
484*e0b8e63eSJohn Marino 	    " z reposition the screen"},
485*e0b8e63eSJohn Marino /* 173   { */
486*e0b8e63eSJohn Marino 	{v_paragraphb,	V_ABS|V_CNT|V_MOVE|VM_CUTREQ|VM_RCM_SET,
487*e0b8e63eSJohn Marino 	    "[count]{",
488*e0b8e63eSJohn Marino 	    " { move back paragraph"},
489*e0b8e63eSJohn Marino /* 174   | */
490*e0b8e63eSJohn Marino 	{v_ncol,	V_CNT|V_MOVE|VM_RCM_SET,
491*e0b8e63eSJohn Marino 	    "[count]|",
492*e0b8e63eSJohn Marino 	    " | move to column"},
493*e0b8e63eSJohn Marino /* 175   } */
494*e0b8e63eSJohn Marino 	{v_paragraphf,	V_ABS|V_CNT|V_MOVE|VM_CUTREQ|VM_RCM_SET,
495*e0b8e63eSJohn Marino 	    "[count]}",
496*e0b8e63eSJohn Marino 	    " } move forward paragraph"},
497*e0b8e63eSJohn Marino /* 176   ~ */
498*e0b8e63eSJohn Marino 	{v_ulcase,	V_CNT|V_DOT|VM_RCM_SET,
499*e0b8e63eSJohn Marino 	    "[count]~",
500*e0b8e63eSJohn Marino 	    " ~ reverse case"},
501*e0b8e63eSJohn Marino };
502