/* vi:set ts=8 sts=4 sw=4:
*
* VIM - Vi IMproved by Bram Moolenaar
*
* Do ":help uganda" in Vim to read copying and usage conditions.
* Do ":help credits" in Vim to see a list of people who contributed.
*/
/*
* This file defines the Ex commands.
* When DO_DECLARE_EXCMD is defined, the table with ex command names and
* options results.
* When DO_DECLARE_EXCMD is NOT defined, the enum with all the Ex commands
* results.
* This clever trick was invented by Ron Aaron.
*/
/*
* When adding an Ex command:
* 1. Add an entry in the table below. Keep it sorted on the shortest
* version of the command name that works. If it doesn't start with a
* lower case letter, add it at the end.
* 2. Add a "case: CMD_xxx" in the big switch in ex_docmd.c.
* 3. Add an entry in the index for Ex commands at ":help ex-cmd-index".
* 4. Add documentation in ../doc/xxx.txt. Add a tag for both the short and
* long name of the command.
*/
#ifdef RANGE
# undef RANGE /* SASC on Amiga defines it */
#endif
#define RANGE 0x001 /* allow a linespecs */
#define BANG 0x002 /* allow a ! after the command name */
#define EXTRA 0x004 /* allow extra args after command name */
#define XFILE 0x008 /* expand wildcards in extra part */
#define NOSPC 0x010 /* no spaces allowed in the extra part */
#define DFLALL 0x020 /* default file range is 1,$ */
#define WHOLEFOLD 0x040 /* extend range to include whole fold also
when less than two numbers given */
#define NEEDARG 0x080 /* argument required */
#define TRLBAR 0x100 /* check for trailing vertical bar */
#define REGSTR 0x200 /* allow "x for register designation */
#define COUNT 0x400 /* allow count in argument, after command */
#define NOTRLCOM 0x800 /* no trailing comment allowed */
#define ZEROR 0x1000 /* zero line number allowed */
#define USECTRLV 0x2000 /* do not remove CTRL-V from argument */
#define NOTADR 0x4000 /* number before command is not an address */
#define EDITCMD 0x8000 /* allow "+command" argument */
#define BUFNAME 0x10000L /* accepts buffer name */
#define BUFUNL 0x20000L /* accepts unlisted buffer too */
#define ARGOPT 0x40000L /* allow "++opt=val" argument */
#define SBOXOK 0x80000L /* allowed in the sandbox */
#define CMDWIN 0x100000L /* allowed in cmdline window */
#define MODIFY 0x200000L /* forbidden in non-'modifiable' buffer */
#define EXFLAGS 0x400000L /* allow flags after count in argument */
#define FILES (XFILE | EXTRA) /* multiple extra files allowed */
#define WORD1 (EXTRA | NOSPC) /* one extra word allowed */
#define FILE1 (FILES | NOSPC) /* 1 file allowed, defaults to current file */
#ifndef DO_DECLARE_EXCMD
typedef struct exarg exarg_T;
#endif
/*
* This array maps ex command names to command codes.
* The order in which command names are listed below is significant --
* ambiguous abbreviations are always resolved to be the first possible match
* (e.g. "r" is taken to mean "read", not "rewind", because "read" comes
* before "rewind").
* Not supported commands are included to avoid ambiguities.
*/
#ifdef EX
# undef EX /* just in case */
#endif
#ifdef DO_DECLARE_EXCMD
# define EX(a, b, c, d) {(char_u *)b, c, (long_u)(d)}
typedef void (*ex_func_T) __ARGS((exarg_T *eap));
static struct cmdname
{
char_u *cmd_name; /* name of the command */
ex_func_T cmd_func; /* function for this command */
long_u cmd_argt; /* flags declared above */
}
# if defined(FEAT_GUI_W16)
_far
# endif
cmdnames[] =
#else
# define EX(a, b, c, d) a
enum CMD_index
#endif
{
EX(CMD_append, "append", ex_append,
BANG|RANGE|ZEROR|TRLBAR|CMDWIN|MODIFY),
EX(CMD_abbreviate, "abbreviate", ex_abbreviate,
EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
EX(CMD_abclear, "abclear", ex_abclear,
EXTRA|TRLBAR|CMDWIN),
EX(CMD_aboveleft, "aboveleft", ex_wrongmodifier,
NEEDARG|EXTRA|NOTRLCOM),
EX(CMD_all, "all", ex_all,
BANG|RANGE|NOTADR|COUNT|TRLBAR),
EX(CMD_amenu, "amenu", ex_menu,
RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
EX(CMD_anoremenu, "anoremenu", ex_menu,
RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
EX(CMD_args, "args", ex_args,
BANG|FILES|EDITCMD|ARGOPT|TRLBAR),
EX(CMD_argadd, "argadd", ex_argadd,
BANG|NEEDARG|RANGE|NOTADR|ZEROR|FILES|TRLBAR),
EX(CMD_argdelete, "argdelete", ex_argdelete,
BANG|RANGE|NOTADR|FILES|TRLBAR),
EX(CMD_argdo, "argdo", ex_listdo,
BANG|NEEDARG|EXTRA|NOTRLCOM),
EX(CMD_argedit, "argedit", ex_argedit,
BANG|NEEDARG|RANGE|NOTADR|FILE1|EDITCMD|ARGOPT|TRLBAR),
EX(CMD_argglobal, "argglobal", ex_args,
BANG|FILES|EDITCMD|ARGOPT|TRLBAR),
EX(CMD_arglocal, "arglocal",