Home | History | Annotate | Line # | Download | only in ex
      1  1.3  christos /*	$NetBSD: ex_cmd.c,v 1.3 2014/01/26 21:43:45 christos Exp $ */
      2  1.1  christos /*-
      3  1.1  christos  * Copyright (c) 1992, 1993, 1994
      4  1.1  christos  *	The Regents of the University of California.  All rights reserved.
      5  1.1  christos  * Copyright (c) 1992, 1993, 1994, 1995, 1996
      6  1.1  christos  *	Keith Bostic.  All rights reserved.
      7  1.1  christos  *
      8  1.1  christos  * See the LICENSE file for redistribution information.
      9  1.1  christos  */
     10  1.1  christos 
     11  1.1  christos #include "config.h"
     12  1.1  christos 
     13  1.3  christos #include <sys/cdefs.h>
     14  1.3  christos #if 0
     15  1.1  christos #ifndef lint
     16  1.1  christos static const char sccsid[] = "Id: ex_cmd.c,v 10.25 2001/06/10 10:23:44 skimo Exp  (Berkeley) Date: 2001/06/10 10:23:44 ";
     17  1.1  christos #endif /* not lint */
     18  1.3  christos #else
     19  1.3  christos __RCSID("$NetBSD: ex_cmd.c,v 1.3 2014/01/26 21:43:45 christos Exp $");
     20  1.3  christos #endif
     21  1.1  christos 
     22  1.1  christos #include <sys/types.h>
     23  1.1  christos #include <sys/queue.h>
     24  1.1  christos 
     25  1.1  christos #include <bitstring.h>
     26  1.1  christos #include <limits.h>
     27  1.1  christos #include <stdio.h>
     28  1.1  christos 
     29  1.1  christos #include "../common/common.h"
     30  1.1  christos 
     31  1.1  christos /*
     32  1.1  christos  * This array maps ex command names to command functions.
     33  1.1  christos  *
     34  1.1  christos  * The order in which command names are listed below is important --
     35  1.1  christos  * ambiguous abbreviations are resolved to be the first possible match,
     36  1.1  christos  * e.g. "r" means "read", not "rewind", because "read" is listed before
     37  1.1  christos  * "rewind".
     38  1.1  christos  *
     39  1.1  christos  * The syntax of the ex commands is unbelievably irregular, and a special
     40  1.1  christos  * case from beginning to end.  Each command has an associated "syntax
     41  1.1  christos  * script" which describes the "arguments" that are possible.  The script
     42  1.1  christos  * syntax is as follows:
     43  1.1  christos  *
     44  1.1  christos  *	!		-- ! flag
     45  1.1  christos  *	1		-- flags: [+-]*[pl#][+-]*
     46  1.1  christos  *	2		-- flags: [-.+^]
     47  1.1  christos  *	3		-- flags: [-.+^=]
     48  1.1  christos  *	b		-- buffer
     49  1.1  christos  *	c[01+a]		-- count (0-N, 1-N, signed 1-N, address offset)
     50  1.1  christos  *	f[N#][or]	-- file (a number or N, optional or required)
     51  1.1  christos  *	l		-- line
     52  1.1  christos  *	S		-- string with file name expansion
     53  1.1  christos  *	s		-- string
     54  1.1  christos  *	W		-- word string
     55  1.1  christos  *	w[N#][or]	-- word (a number or N, optional or required)
     56  1.1  christos  */
     57  1.1  christos EXCMDLIST const cmds[] = {
     58  1.1  christos /* C_SCROLL */
     59  1.1  christos 	{L("\004"),	ex_pr,		E_ADDR2,
     60  1.1  christos 	    "",
     61  1.1  christos 	    "^D",
     62  1.1  christos 	    "scroll lines"},
     63  1.1  christos /* C_BANG */
     64  1.1  christos 	{L("!"),		ex_bang,	E_ADDR2_NONE|E_SECURE,
     65  1.1  christos 	    "S",
     66  1.1  christos 	    "[line [,line]] ! command",
     67  1.1  christos 	    "filter lines through commands or run commands"},
     68  1.1  christos /* C_HASH */
     69  1.1  christos 	{L("#"),		ex_number,	E_ADDR2|E_CLRFLAG,
     70  1.1  christos 	    "ca1",
     71  1.1  christos 	    "[line [,line]] # [count] [l]",
     72  1.1  christos 	    "display numbered lines"},
     73  1.1  christos /* C_SUBAGAIN */
     74  1.1  christos 	{L("&"),		ex_subagain,	E_ADDR2|E_ADDR_ZERO,
     75  1.1  christos 	    "s",
     76  1.1  christos 	    "[line [,line]] & [cgr] [count] [#lp]",
     77  1.1  christos 	    "repeat the last subsitution"},
     78  1.1  christos /* C_STAR */
     79  1.1  christos 	{L("*"),		ex_at,		0,
     80  1.1  christos 	    "b",
     81  1.1  christos 	    "* [buffer]",
     82  1.1  christos 	    "execute a buffer"},
     83  1.1  christos /* C_SHIFTL */
     84  1.1  christos 	{L("<"),		ex_shiftl,	E_ADDR2|E_AUTOPRINT,
     85  1.1  christos 	    "ca1",
     86  1.1  christos 	    "[line [,line]] <[<...] [count] [flags]",
     87  1.1  christos 	    "shift lines left"},
     88  1.1  christos /* C_EQUAL */
     89  1.1  christos 	{L("="),		ex_equal,	E_ADDR1|E_ADDR_ZERO|E_ADDR_ZERODEF,
     90  1.1  christos 	    "1",
     91  1.1  christos 	    "[line] = [flags]",
     92  1.1  christos 	    "display line number"},
     93  1.1  christos /* C_SHIFTR */
     94  1.1  christos 	{L(">"),		ex_shiftr,	E_ADDR2|E_AUTOPRINT,
     95  1.1  christos 	    "ca1",
     96  1.1  christos 	    "[line [,line]] >[>...] [count] [flags]",
     97  1.1  christos 	    "shift lines right"},
     98  1.1  christos /* C_AT */
     99  1.1  christos 	{L("@"),		ex_at,		E_ADDR2,
    100  1.1  christos 	    "b",
    101  1.1  christos 	    "@ [buffer]",
    102  1.1  christos 	    "execute a buffer"},
    103  1.1  christos /* C_APPEND */
    104  1.1  christos 	{L("append"),	ex_append,	E_ADDR1|E_ADDR_ZERO|E_ADDR_ZERODEF,
    105  1.1  christos 	    "!",
    106  1.1  christos 	    "[line] a[ppend][!]",
    107  1.1  christos 	    "append input to a line"},
    108  1.1  christos /* C_ABBR */
    109  1.1  christos 	{L("abbreviate"), 	ex_abbr,	0,
    110  1.1  christos 	    "W",
    111  1.1  christos 	    "ab[brev] [word replace]",
    112  1.1  christos 	    "specify an input abbreviation"},
    113  1.1  christos /* C_ARGS */
    114  1.1  christos 	{L("args"),	ex_args,	0,
    115  1.1  christos 	    "",
    116  1.1  christos 	    "ar[gs]",
    117  1.1  christos 	    "display file argument list"},
    118  1.1  christos /* C_BG */
    119  1.1  christos 	{L("bg"),		ex_bg,		E_VIONLY,
    120  1.1  christos 	    "",
    121  1.1  christos 	    "bg",
    122  1.1  christos 	    "put a foreground screen into the background"},
    123  1.1  christos /* C_CHANGE */
    124  1.1  christos 	{L("change"),	ex_change,	E_ADDR2|E_ADDR_ZERODEF,
    125  1.1  christos 	    "!ca",
    126  1.1  christos 	    "[line [,line]] c[hange][!] [count]",
    127  1.1  christos 	    "change lines to input"},
    128  1.1  christos /* C_CD */
    129  1.1  christos 	{L("cd"),		ex_cd,		0,
    130  1.1  christos 	    "!f1o",
    131  1.1  christos 	    "cd[!] [directory]",
    132  1.1  christos 	    "change the current directory"},
    133  1.1  christos /* C_CHDIR */
    134  1.1  christos 	{L("chdir"),	ex_cd,		0,
    135  1.1  christos 	    "!f1o",
    136  1.1  christos 	    "chd[ir][!] [directory]",
    137  1.1  christos 	    "change the current directory"},
    138  1.1  christos /* C_COPY */
    139  1.1  christos 	{L("copy"),	ex_copy,	E_ADDR2|E_AUTOPRINT,
    140  1.1  christos 	    "l1",
    141  1.1  christos 	    "[line [,line]] co[py] line [flags]",
    142  1.1  christos 	    "copy lines elsewhere in the file"},
    143  1.1  christos /* C_CSCOPE */
    144  1.1  christos 	{L("cscope"),      ex_cscope,      0,
    145  1.1  christos 	    "!s",
    146  1.1  christos 	    "cs[cope] command [args]",
    147  1.1  christos 	    "create a set of tags using a cscope command"},
    148  1.1  christos /*
    149  1.1  christos  * !!!
    150  1.1  christos  * Adding new commands starting with 'd' may break the delete command code
    151  1.1  christos  * in ex_cmd() (the ex parser).  Read through the comments there, first.
    152  1.1  christos  */
    153  1.1  christos /* C_DELETE */
    154  1.1  christos 	{L("delete"),	ex_delete,	E_ADDR2|E_AUTOPRINT,
    155  1.1  christos 	    "bca1",
    156  1.1  christos 	    "[line [,line]] d[elete][flags] [buffer] [count] [flags]",
    157  1.1  christos 	    "delete lines from the file"},
    158  1.1  christos /* C_DISPLAY */
    159  1.1  christos 	{L("display"),	ex_display,	0,
    160  1.1  christos 	    "w1r",
    161  1.1  christos 	    "display b[uffers] | c[onnections] | s[creens] | t[ags]",
    162  1.1  christos 	    "display buffers, connections, screens or tags"},
    163  1.1  christos /* C_EDIT */
    164  1.1  christos 	{L("edit"),	ex_edit,	E_NEWSCREEN,
    165  1.1  christos 	    "f1o",
    166  1.1  christos 	    "[Ee][dit][!] [+cmd] [file]",
    167  1.1  christos 	    "begin editing another file"},
    168  1.1  christos /* C_EX */
    169  1.1  christos 	{L("ex"),		ex_edit,	E_NEWSCREEN,
    170  1.1  christos 	    "f1o",
    171  1.1  christos 	    "[Ee]x[!] [+cmd] [file]",
    172  1.1  christos 	    "begin editing another file"},
    173  1.1  christos /* C_EXUSAGE */
    174  1.1  christos 	{L("exusage"),	ex_usage,	0,
    175  1.1  christos 	    "w1o",
    176  1.1  christos 	    "[exu]sage [command]",
    177  1.1  christos 	    "display ex command usage statement"},
    178  1.1  christos /* C_FILE */
    179  1.1  christos 	{L("file"),	ex_file,	0,
    180  1.1  christos 	    "f1o",
    181  1.1  christos 	    "f[ile] [name]",
    182  1.1  christos 	    "display (and optionally set) file name"},
    183  1.1  christos /* C_FG */
    184  1.1  christos 	{L("fg"),		ex_fg,		E_NEWSCREEN|E_VIONLY,
    185  1.1  christos 	    "f1o",
    186  1.1  christos 	    "[Ff]g [file]",
    187  1.1  christos 	    "bring a backgrounded screen into the foreground"},
    188  1.1  christos /* C_GLOBAL */
    189  1.1  christos 	{L("global"),	ex_global,	E_ADDR2_ALL,
    190  1.1  christos 	    "!s",
    191  1.1  christos 	    "[line [,line]] g[lobal][!] [;/]RE[;/] [commands]",
    192  1.1  christos 	    "execute a global command on lines matching an RE"},
    193  1.1  christos /* C_HELP */
    194  1.1  christos 	{L("help"),	ex_help,	0,
    195  1.1  christos 	    "",
    196  1.1  christos 	    "he[lp]",
    197  1.1  christos 	    "display help statement"},
    198  1.1  christos /* C_INSERT */
    199  1.1  christos 	{L("insert"),	ex_insert,	E_ADDR1|E_ADDR_ZERO|E_ADDR_ZERODEF,
    200  1.1  christos 	    "!",
    201  1.1  christos 	    "[line] i[nsert][!]",
    202  1.1  christos 	    "insert input before a line"},
    203  1.1  christos /* C_JOIN */
    204  1.1  christos 	{L("join"),	ex_join,	E_ADDR2|E_AUTOPRINT,
    205  1.1  christos 	    "!ca1",
    206  1.1  christos 	    "[line [,line]] j[oin][!] [count] [flags]",
    207  1.1  christos 	    "join lines into a single line"},
    208  1.1  christos /* C_K */
    209  1.1  christos 	{L("k"),		ex_mark,	E_ADDR1,
    210  1.1  christos 	    "w1r",
    211  1.1  christos 	    "[line] k key",
    212  1.1  christos 	    "mark a line position"},
    213  1.1  christos /* C_LIST */
    214  1.1  christos 	{L("list"),	ex_list,	E_ADDR2|E_CLRFLAG,
    215  1.1  christos 	    "ca1",
    216  1.1  christos 	    "[line [,line]] l[ist] [count] [#]",
    217  1.1  christos 	    "display lines in an unambiguous form"},
    218  1.1  christos /* C_MOVE */
    219  1.1  christos 	{L("move"),	ex_move,	E_ADDR2|E_AUTOPRINT,
    220  1.1  christos 	    "l",
    221  1.1  christos 	    "[line [,line]] m[ove] line",
    222  1.1  christos 	    "move lines elsewhere in the file"},
    223  1.1  christos /* C_MARK */
    224  1.1  christos 	{L("mark"),	ex_mark,	E_ADDR1,
    225  1.1  christos 	    "w1r",
    226  1.1  christos 	    "[line] ma[rk] key",
    227  1.1  christos 	    "mark a line position"},
    228  1.1  christos /* C_MAP */
    229  1.1  christos 	{L("map"),		ex_map,		0,
    230  1.1  christos 	    "!W",
    231  1.1  christos 	    "map[!] [keys replace]",
    232  1.1  christos 	    "map input or commands to one or more keys"},
    233  1.1  christos /* C_MKEXRC */
    234  1.1  christos 	{L("mkexrc"),	ex_mkexrc,	0,
    235  1.1  christos 	    "!f1r",
    236  1.1  christos 	    "mkexrc[!] file",
    237  1.1  christos 	    "write a .exrc file"},
    238  1.1  christos /* C_NEXT */
    239  1.1  christos 	{L("next"),	ex_next,	E_NEWSCREEN,
    240  1.1  christos 	    "!fN",
    241  1.1  christos 	    "[Nn][ext][!] [+cmd] [file ...]",
    242  1.1  christos 	    "edit (and optionally specify) the next file"},
    243  1.1  christos /* C_NUMBER */
    244  1.1  christos 	{L("number"),	ex_number,	E_ADDR2|E_CLRFLAG,
    245  1.1  christos 	    "ca1",
    246  1.1  christos 	    "[line [,line]] nu[mber] [count] [l]",
    247  1.1  christos 	    "change display to number lines"},
    248  1.1  christos /* C_OPEN */
    249  1.1  christos 	{L("open"),	ex_open,	E_ADDR1,
    250  1.1  christos 	    "s",
    251  1.1  christos 	    "[line] o[pen] [/RE/] [flags]",
    252  1.1  christos 	    "enter \"open\" mode (not implemented)"},
    253  1.1  christos /* C_PRINT */
    254  1.1  christos 	{L("print"),	ex_pr,		E_ADDR2|E_CLRFLAG,
    255  1.1  christos 	    "ca1",
    256  1.1  christos 	    "[line [,line]] p[rint] [count] [#l]",
    257  1.1  christos 	    "display lines"},
    258  1.1  christos /* C_PERLCMD */
    259  1.1  christos 	{L("perl"),	ex_perl,	E_ADDR2_ALL|E_ADDR_ZERO|
    260  1.1  christos 					    E_ADDR_ZERODEF|E_SECURE,
    261  1.1  christos 	    "s",
    262  1.1  christos 	    "pe[rl] cmd",
    263  1.1  christos 	    "run the perl interpreter with the command"},
    264  1.1  christos /* C_PERLDOCMD */
    265  1.1  christos 	{L("perldo"),	ex_perl,	E_ADDR2|E_ADDR_ZERO|
    266  1.1  christos 					    E_ADDR_ZERODEF|E_SECURE,
    267  1.1  christos 	    "s",
    268  1.1  christos 	    "perld[o] cmd",
    269  1.1  christos 	    "run the perl interpreter with the command, on each line"},
    270  1.1  christos /* C_PRESERVE */
    271  1.1  christos 	{L("preserve"),	ex_preserve,	0,
    272  1.1  christos 	    "",
    273  1.1  christos 	    "pre[serve]",
    274  1.1  christos 	    "preserve an edit session for recovery"},
    275  1.1  christos /* C_PREVIOUS */
    276  1.1  christos 	{L("previous"),	ex_prev,	E_NEWSCREEN,
    277  1.1  christos 	    "!",
    278  1.1  christos 	    "[Pp]rev[ious][!]",
    279  1.1  christos 	    "edit the previous file in the file argument list"},
    280  1.1  christos /* C_PUT */
    281  1.1  christos 	{L("put"),		ex_put,
    282  1.1  christos 	    E_ADDR1|E_AUTOPRINT|E_ADDR_ZERO|E_ADDR_ZERODEF,
    283  1.1  christos 	    "b",
    284  1.1  christos 	    "[line] pu[t] [buffer]",
    285  1.1  christos 	    "append a cut buffer to the line"},
    286  1.1  christos /* C_QUIT */
    287  1.1  christos 	{L("quit"),	ex_quit,	0,
    288  1.1  christos 	    "!",
    289  1.1  christos 	    "q[uit][!]",
    290  1.1  christos 	    "exit ex/vi"},
    291  1.1  christos /* C_READ */
    292  1.1  christos 	{L("read"),	ex_read,	E_ADDR1|E_ADDR_ZERO|E_ADDR_ZERODEF,
    293  1.1  christos 	    "s",
    294  1.1  christos 	    "[line] r[ead] [!cmd | [file]]",
    295  1.1  christos 	    "append input from a command or file to the line"},
    296  1.1  christos /* C_RECOVER */
    297  1.1  christos 	{L("recover"),	ex_recover,	0,
    298  1.1  christos 	    "!f1r",
    299  1.1  christos 	    "recover[!] file",
    300  1.1  christos 	    "recover a saved file"},
    301  1.1  christos /* C_RESIZE */
    302  1.1  christos 	{L("resize"),	ex_resize,	E_VIONLY,
    303  1.1  christos 	    "c+",
    304  1.1  christos 	    "resize [+-]rows",
    305  1.1  christos 	    "grow or shrink the current screen"},
    306  1.1  christos /* C_REWIND */
    307  1.1  christos 	{L("rewind"),	ex_rew,		0,
    308  1.1  christos 	    "!",
    309  1.1  christos 	    "rew[ind][!]",
    310  1.1  christos 	    "re-edit all the files in the file argument list"},
    311  1.2  christos #ifdef GTAGS
    312  1.2  christos /* C_RTAG */
    313  1.2  christos 	{L("rtag"),	ex_rtag_push,	E_NEWSCREEN,
    314  1.2  christos 	    "!w1o",
    315  1.2  christos 	    "rta[g][!] [string]",
    316  1.2  christos 	    "edit the file containing the tag"},
    317  1.2  christos #endif
    318  1.1  christos /*
    319  1.1  christos  * !!!
    320  1.1  christos  * Adding new commands starting with 's' may break the substitute command code
    321  1.1  christos  * in ex_cmd() (the ex parser).  Read through the comments there, first.
    322  1.1  christos  */
    323  1.1  christos /* C_SUBSTITUTE */
    324  1.1  christos 	{L("s"),		ex_s,		E_ADDR2|E_ADDR_ZERO,
    325  1.1  christos 	    "s",
    326  1.1  christos 	    "[line [,line]] s [[/;]RE[/;]repl[/;] [cgr] [count] [#lp]]",
    327  1.1  christos 	    "substitute on lines matching an RE"},
    328  1.1  christos /* C_SCRIPT */
    329  1.1  christos 	{L("script"),	ex_script,	E_SECURE,
    330  1.1  christos 	    "!f1o",
    331  1.1  christos 	    "sc[ript][!] [file]",
    332  1.1  christos 	    "run a shell in a screen"},
    333  1.1  christos /* C_SET */
    334  1.1  christos 	{L("set"),		ex_set,		0,
    335  1.1  christos 	    "wN",
    336  1.1  christos 	    "se[t] [option[=[value]]...] [nooption ...] [option? ...] [all]",
    337  1.1  christos 	    "set options (use \":set all\" to see all options)"},
    338  1.1  christos /* C_SHELL */
    339  1.1  christos 	{L("shell"),	ex_shell,	E_SECURE,
    340  1.1  christos 	    "",
    341  1.1  christos 	    "sh[ell]",
    342  1.1  christos 	    "suspend editing and run a shell"},
    343  1.1  christos /* C_SOURCE */
    344  1.1  christos 	{L("source"),	ex_source,	0,
    345  1.1  christos 	    "f1r",
    346  1.1  christos 	    "so[urce] file",
    347  1.1  christos 	    "read a file of ex commands"},
    348  1.1  christos /* C_STOP */
    349  1.1  christos 	{L("stop"),	ex_stop,	E_SECURE,
    350  1.1  christos 	    "!",
    351  1.1  christos 	    "st[op][!]",
    352  1.1  christos 	    "suspend the edit session"},
    353  1.1  christos /* C_SUSPEND */
    354  1.1  christos 	{L("suspend"),	ex_stop,	E_SECURE,
    355  1.1  christos 	    "!",
    356  1.1  christos 	    "su[spend][!]",
    357  1.1  christos 	    "suspend the edit session"},
    358  1.1  christos /* C_T */
    359  1.1  christos 	{L("t"),		ex_copy,	E_ADDR2|E_AUTOPRINT,
    360  1.1  christos 	    "l1",
    361  1.1  christos 	    "[line [,line]] t line [flags]",
    362  1.1  christos 	    "copy lines elsewhere in the file"},
    363  1.1  christos /* C_TAG */
    364  1.1  christos 	{L("tag"),		ex_tag_push,	E_NEWSCREEN,
    365  1.1  christos 	    "!w1o",
    366  1.1  christos 	    "[Tt]a[g][!] [string]",
    367  1.1  christos 	    "edit the file containing the tag"},
    368  1.1  christos /* C_TAGNEXT */
    369  1.1  christos 	{L("tagnext"),	ex_tag_next,	0,
    370  1.1  christos 	    "!",
    371  1.1  christos 	    "tagn[ext][!]",
    372  1.1  christos 	    "move to the next tag"},
    373  1.1  christos /* C_TAGPOP */
    374  1.1  christos 	{L("tagpop"),	ex_tag_pop,	0,
    375  1.1  christos 	    "!w1o",
    376  1.1  christos 	    "tagp[op][!] [number | file]",
    377  1.1  christos 	    "return to the previous group of tags"},
    378  1.1  christos /* C_TAGPREV */
    379  1.1  christos 	{L("tagprev"),	ex_tag_prev,	0,
    380  1.1  christos 	    "!",
    381  1.1  christos 	    "tagpr[ev][!]",
    382  1.1  christos 	    "move to the previous tag"},
    383  1.1  christos /* C_TAGTOP */
    384  1.1  christos 	{L("tagtop"),	ex_tag_top,	0,
    385  1.1  christos 	    "!",
    386  1.1  christos 	    "tagt[op][!]",
    387  1.1  christos 	    "discard all tags"},
    388  1.1  christos /* C_TCLCMD */
    389  1.1  christos 	{L("tcl"),		ex_tcl,		E_ADDR2_ALL|E_ADDR_ZERO|
    390  1.1  christos 					    E_ADDR_ZERODEF|E_SECURE,
    391  1.1  christos 	    "s",
    392  1.1  christos 	    "tc[l] cmd",
    393  1.1  christos 	    "run the tcl interpreter with the command"},
    394  1.1  christos /* C_UNDO */
    395  1.1  christos 	{L("undo"),	ex_undo,	E_AUTOPRINT,
    396  1.1  christos 	    "",
    397  1.1  christos 	    "u[ndo]",
    398  1.1  christos 	    "undo the most recent change"},
    399  1.1  christos /* C_UNABBREVIATE */
    400  1.1  christos 	{L("unabbreviate"),ex_unabbr,	0,
    401  1.1  christos 	    "w1r",
    402  1.1  christos 	    "una[bbrev] word",
    403  1.1  christos 	    "delete an abbreviation"},
    404  1.1  christos /* C_UNMAP */
    405  1.1  christos 	{L("unmap"),	ex_unmap,	0,
    406  1.1  christos 	    "!w1r",
    407  1.1  christos 	    "unm[ap][!] word",
    408  1.1  christos 	    "delete an input or command map"},
    409  1.1  christos /* C_V */
    410  1.1  christos 	{L("v"),		ex_v,		E_ADDR2_ALL,
    411  1.1  christos 	    "s",
    412  1.1  christos 	    "[line [,line]] v [;/]RE[;/] [commands]",
    413  1.1  christos 	    "execute a global command on lines NOT matching an RE"},
    414  1.1  christos /* C_VERSION */
    415  1.1  christos 	{L("version"),	ex_version,	0,
    416  1.1  christos 	    "",
    417  1.1  christos 	    "version",
    418  1.1  christos 	    "display the program version information"},
    419  1.1  christos /* C_VISUAL_EX */
    420  1.1  christos 	{L("visual"),	ex_visual,	E_ADDR1|E_ADDR_ZERODEF,
    421  1.1  christos 	    "2c11",
    422  1.1  christos 	    "[line] vi[sual] [-|.|+|^] [window_size] [flags]",
    423  1.1  christos 	    "enter visual (vi) mode from ex mode"},
    424  1.1  christos /* C_VISUAL_VI */
    425  1.1  christos 	{L("visual"),	ex_edit,	E_NEWSCREEN,
    426  1.1  christos 	    "f1o",
    427  1.1  christos 	    "[Vv]i[sual][!] [+cmd] [file]",
    428  1.1  christos 	    "edit another file (from vi mode only)"},
    429  1.1  christos /* C_VIUSAGE */
    430  1.1  christos 	{L("viusage"),	ex_viusage,	0,
    431  1.1  christos 	    "w1o",
    432  1.1  christos 	    "[viu]sage [key]",
    433  1.1  christos 	    "display vi key usage statement"},
    434  1.1  christos /* C_VSPLIT */
    435  1.1  christos 	{L("vsplit"),	ex_edit,	E_VIONLY,
    436  1.1  christos 	    "f1o",
    437  1.1  christos 	    "vs[plit] [+cmd] [file]",
    438  1.1  christos 	    "split the current screen vertically"},
    439  1.1  christos /* C_WRITE */
    440  1.1  christos 	{L("write"),	ex_write,	E_ADDR2_ALL|E_ADDR_ZERODEF,
    441  1.1  christos 	    "!s",
    442  1.1  christos 	    "[line [,line]] w[rite][!] [ !cmd | [>>] [file]]",
    443  1.1  christos 	    "write the file"},
    444  1.1  christos /* C_WN */
    445  1.1  christos 	{L("wn"),		ex_wn,		E_ADDR2_ALL|E_ADDR_ZERODEF,
    446  1.1  christos 	    "!s",
    447  1.1  christos 	    "[line [,line]] wn[!] [>>] [file]",
    448  1.1  christos 	    "write the file and switch to the next file"},
    449  1.1  christos /* C_WQ */
    450  1.1  christos 	{L("wq"),		ex_wq,		E_ADDR2_ALL|E_ADDR_ZERODEF,
    451  1.1  christos 	    "!s",
    452  1.1  christos 	    "[line [,line]] wq[!] [>>] [file]",
    453  1.1  christos 	    "write the file and exit"},
    454  1.1  christos /* C_XIT */
    455  1.1  christos 	{L("xit"),		ex_xit,		E_ADDR2_ALL|E_ADDR_ZERODEF,
    456  1.1  christos 	    "!f1o",
    457  1.1  christos 	    "[line [,line]] x[it][!] [file]",
    458  1.1  christos 	    "exit"},
    459  1.1  christos /* C_YANK */
    460  1.1  christos 	{L("yank"),	ex_yank,	E_ADDR2,
    461  1.1  christos 	    "bca",
    462  1.1  christos 	    "[line [,line]] ya[nk] [buffer] [count]",
    463  1.1  christos 	    "copy lines to a cut buffer"},
    464  1.1  christos /* C_Z */
    465  1.1  christos 	{L("z"),		ex_z,		E_ADDR1,
    466  1.1  christos 	    "3c01",
    467  1.1  christos 	    "[line] z [-|.|+|^|=] [count] [flags]",
    468  1.1  christos 	    "display different screens of the file"},
    469  1.1  christos /* C_SUBTILDE */
    470  1.1  christos 	{L("~"),		ex_subtilde,	E_ADDR2|E_ADDR_ZERO,
    471  1.1  christos 	    "s",
    472  1.1  christos 	    "[line [,line]] ~ [cgr] [count] [#lp]",
    473  1.1  christos 	    "replace previous RE with previous replacement string,"},
    474  1.2  christos 	{NULL,			NULL,		0,
    475  1.2  christos 	     NULL,
    476  1.2  christos 	     NULL,
    477  1.2  christos 	     NULL,},
    478  1.1  christos };
    479