Data Structures | Macros | Enumerations | Functions | Variables
ex_docmd.c File Reference
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include "nvim/api/private/helpers.h"
#include "nvim/ascii.h"
#include "nvim/buffer.h"
#include "nvim/change.h"
#include "nvim/charset.h"
#include "nvim/cursor.h"
#include "nvim/debugger.h"
#include "nvim/diff.h"
#include "nvim/digraph.h"
#include "nvim/edit.h"
#include "nvim/eval.h"
#include "nvim/eval/userfunc.h"
#include "nvim/event/rstream.h"
#include "nvim/event/wstream.h"
#include "nvim/ex_cmds.h"
#include "nvim/ex_cmds2.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/ex_docmd.h"
#include "nvim/ex_eval.h"
#include "nvim/ex_getln.h"
#include "nvim/ex_session.h"
#include "nvim/file_search.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"
#include "nvim/func_attr.h"
#include "nvim/garray.h"
#include "nvim/getchar.h"
#include "nvim/globals.h"
#include "nvim/hardcopy.h"
#include "nvim/highlight_group.h"
#include "nvim/if_cscope.h"
#include "nvim/input.h"
#include "nvim/keycodes.h"
#include "nvim/lua/executor.h"
#include "nvim/main.h"
#include "nvim/mark.h"
#include "nvim/match.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/menu.h"
#include "nvim/message.h"
#include "nvim/mouse.h"
#include "nvim/move.h"
#include "nvim/normal.h"
#include "nvim/ops.h"
#include "nvim/option.h"
#include "nvim/os/input.h"
#include "nvim/os/os.h"
#include "nvim/os/time.h"
#include "nvim/os_unix.h"
#include "nvim/path.h"
#include "nvim/quickfix.h"
#include "nvim/regexp.h"
#include "nvim/screen.h"
#include "nvim/search.h"
#include "nvim/shada.h"
#include "nvim/sign.h"
#include "nvim/spell.h"
#include "nvim/spellfile.h"
#include "nvim/state.h"
#include "nvim/strings.h"
#include "nvim/syntax.h"
#include "nvim/tag.h"
#include "nvim/terminal.h"
#include "nvim/ui.h"
#include "nvim/undo.h"
#include "nvim/undo_defs.h"
#include "nvim/version.h"
#include "nvim/vim.h"
#include "nvim/window.h"

Data Structures

struct  wcmd_T
 
struct  loop_cookie
 
struct  dbg_stuff
 
struct  cmdmod
 

Macros

#define IS_USER_CMDIDX(idx)   ((int)(idx) < 0)
 
#define FREE_WCMD(wcmd)   xfree((wcmd)->line)
 
#define ex_language   ex_ni
 
#define CURRENT_WIN_NR   current_win_nr(curwin)
 
#define LAST_WIN_NR   current_win_nr(NULL)
 
#define CURRENT_TAB_NR   current_tab_nr(curtab)
 
#define LAST_TAB_NR   current_tab_nr(NULL)
 
#define ERROR(msg)
 
#define ESCAPE_CHARS   escape_chars
 
#define FREE_AENTRY_FNAME(arg)   xfree(arg->ae_fname)
 

Enumerations

enum  {
  SPEC_PERC = 0, SPEC_HASH, SPEC_CWORD, SPEC_CCWORD,
  SPEC_CEXPR, SPEC_CFILE, SPEC_SFILE, SPEC_SLNUM,
  SPEC_STACK, SPEC_AFILE, SPEC_ABUF, SPEC_AMATCH,
  SPEC_SFLNUM, SPEC_SID
}
 

Functions

void do_exmode (void)
 Repeatedly get commands for Ex mode, until the ":vi" command is given. More...
 
int do_cmdline_cmd (const char *cmd)
 Execute a simple command line. Used for translated commands like "*". More...
 
int do_cmdline (char *cmdline, LineGetter fgetline, void *cookie, int flags)
 
int getline_equal (LineGetter fgetline, void *cookie, LineGetter func)
 
voidgetline_cookie (LineGetter fgetline, void *cookie)
 
void set_cmd_addr_type (exarg_T *eap, char_u *p)
 
linenr_T get_cmd_default_range (exarg_T *eap)
 Get default range number for command based on its address type. More...
 
void set_cmd_dflall_range (exarg_T *eap)
 Set default command range for -range=% based on the addr type of the command. More...
 
void set_cmd_count (exarg_T *eap, long count, bool validate)
 
bool is_cmd_ni (cmdidx_T cmdidx)
 Check if command is not implemented. More...
 
bool parse_cmdline (char *cmdline, exarg_T *eap, CmdParseInfo *cmdinfo, char **errormsg)
 
void execute_cmd (exarg_T *eap, CmdParseInfo *cmdinfo)
 
char * ex_errmsg (const char *const msg, const char *const arg) FUNC_ATTR_NONNULL_ALL
 
int parse_command_modifiers (exarg_T *eap, char **errormsg, bool skip_only)
 
int parse_cmd_address (exarg_T *eap, char **errormsg, bool silent) FUNC_ATTR_NONNULL_ALL
 
int checkforcmd (char **pp, char *cmd, int len)
 
char * find_ex_command (exarg_T *eap, int *full) FUNC_ATTR_NONNULL_ARG(1)
 
int modifier_len (char *cmd)
 
int cmd_exists (const char *const name)
 
void f_fullcommand (typval_T *argvars, typval_T *rettv, FunPtr fptr)
 "fullcommand" function More...
 
const char * set_one_cmd_context (expand_T *xp, const char *buff)
 
char * skip_range (const char *cmd, int *ctx)
 
void ex_ni (exarg_T *eap)
 Stub function for command which is Not Implemented. NI! More...
 
char * invalid_range (exarg_T *eap)
 
char * replace_makeprg (exarg_T *eap, char *p, char **cmdlinep)
 
int expand_filename (exarg_T *eap, char_u **cmdlinep, char **errormsgp)
 
void separate_nextcmd (exarg_T *eap)
 Check for '|' to separate commands and '"' to start comments. More...
 
int get_bad_opt (const char_u *p, exarg_T *eap) FUNC_ATTR_NONNULL_ALL
 
int ends_excmd (int c) FUNC_ATTR_CONST
 
char_ufind_nextcmd (const char_u *p)
 
char_ucheck_nextcmd (char_u *p)
 
char * get_command_name (expand_T *xp, int idx)
 Function given to ExpandGeneric() to obtain the list of command names. More...
 
char * uc_validate_name (char *name)
 
int uc_add_command (char *name, size_t name_len, char *rep, uint32_t argt, long def, int flags, int compl, char *compl_arg, LuaRef compl_luaref, cmd_addr_T addr_type, LuaRef luaref, bool force) FUNC_ATTR_NONNULL_ARG(1
 
 replace_termcodes (rep, STRLEN(rep), &rep_buf, 0, NULL, CPO_TO_CPO_FLAGS)
 
 if (rep_buf==NULL)
 
 if (flags &UC_BUFFER)
 
 for (i=0;i< gap->ga_len;++i)
 
 if (cmp !=0)
 
 xfree (compl_arg)
 
 NLUA_CLEAR_REF (luaref)
 
 NLUA_CLEAR_REF (compl_luaref)
 
void ex_comclear (exarg_T *eap)
 
void free_ucmd (ucmd_T *cmd)
 
void uc_clear (garray_T *gap)
 Clear all user commands for "gap". More...
 
bool uc_split_args_iter (const char *arg, size_t arglen, size_t *end, char *buf, size_t *len)
 
size_t uc_mods (char *buf)
 
char * get_user_cmd_addr_type (expand_T *xp, int idx)
 Function given to ExpandGeneric() to obtain the list of user address type names. More...
 
char * get_user_commands (expand_T *xp FUNC_ATTR_UNUSED, int idx) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
 Function given to ExpandGeneric() to obtain the list of user command names. More...
 
char * get_user_cmd_flags (expand_T *xp, int idx)
 
char * get_user_cmd_nargs (expand_T *xp, int idx)
 Function given to ExpandGeneric() to obtain the list of values for -nargs. More...
 
char * get_user_cmd_complete (expand_T *xp, int idx)
 Function given to ExpandGeneric() to obtain the list of values for -complete. More...
 
int parse_addr_type_arg (char *value, int vallen, cmd_addr_T *addr_type_arg) FUNC_ATTR_NONNULL_ALL
 Parse address type argument. More...
 
int parse_compl_arg (const char *value, int vallen, int *complp, uint32_t *argt, char **compl_arg) FUNC_ATTR_NONNULL_ALL
 
int cmdcomplete_str_to_type (const char *complete_str)
 
void not_exiting (void)
 
bool before_quit_autocmds (win_T *wp, bool quit_all, bool forceit)
 
void ex_win_close (int forceit, win_T *win, tabpage_T *tp)
 
void tabpage_close (int forceit)
 Close the current tab page. More...
 
void tabpage_close_other (tabpage_T *tp, int forceit)
 
void ex_all (exarg_T *eap)
 
void alist_clear (alist_T *al)
 Clear an argument list: free all file names and reset it to zero entries. More...
 
void alist_init (alist_T *al)
 Init an argument list. More...
 
void alist_unlink (alist_T *al)
 
void alist_new (void)
 Create a new argument list and use it for the current window. More...
 
void alist_expand (int *fnum_list, int fnum_len)
 
void alist_set (alist_T *al, int count, char **files, int use_curbuf, int *fnum_list, int fnum_len)
 
void alist_add (alist_T *al, char *fname, int set_fnum)
 
void ex_splitview (exarg_T *eap)
 
void tabpage_new (void)
 Open a new tab page. More...
 
void do_exedit (exarg_T *eap, win_T *old_curwin)
 
bool changedir_func (char *new_dir, CdScope scope)
 
void ex_cd (exarg_T *eap)
 ":cd", ":tcd", ":lcd", ":chdir", "tchdir" and ":lchdir". More...
 
void do_sleep (long msec)
 Sleep for "msec" milliseconds, but keep checking for a CTRL-C every second. More...
 
void ex_may_print (exarg_T *eap)
 Print the current line if flags were given to the Ex command. More...
 
int vim_mkdir_emsg (const char *const name, const int prot) FUNC_ATTR_NONNULL_ALL
 
FILE * open_exfile (char_u *fname, int forceit, char *mode)
 
void update_topline_cursor (void)
 Update w_topline, w_leftcol and the cursor position. More...
 
bool save_current_state (save_state_T *sst) FUNC_ATTR_NONNULL_ALL
 
void restore_current_state (save_state_T *sst) FUNC_ATTR_NONNULL_ALL
 
void exec_normal_cmd (char_u *cmd, int remap, bool silent)
 
void exec_normal (bool was_typed)
 
ssize_t find_cmdline_var (const char_u *src, size_t *usedlen) FUNC_ATTR_NONNULL_ALL
 
char_ueval_vars (char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnump, char **errormsg, int *escaped)
 
char * expand_sfile (char *arg)
 
void dialog_msg (char *buff, char *format, char *fname)
 
char * get_behave_arg (expand_T *xp, int idx)
 
char * get_messages_arg (expand_T *xp FUNC_ATTR_UNUSED, int idx)
 
char * get_mapclear_arg (expand_T *xp FUNC_ATTR_UNUSED, int idx)
 
void filetype_plugin_enable (void)
 
void filetype_maybe_enable (void)
 Enable filetype detection if the user did not explicitly disable it. More...
 
void set_no_hlsearch (bool flag)
 
bool is_loclist_cmd (int cmdidx) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
 
bool get_pressedreturn (void)
 
void set_pressedreturn (bool val)
 
bool cmd_can_preview (char *cmd)
 
Dictionary commands_array (buf_T *buf)
 
void verify_command (char *cmd)
 
uint32_t get_cmd_argt (cmdidx_T cmdidx)
 Get argt of command with id. More...
 

Variables

garray_T ucmds = { 0, 0, sizeof(ucmd_T), 4, NULL }
 
int int i
 
int cmp = 1
 
char * rep_buf = NULL
 
garray_Tgap
 
 else
 
cmd uc_rep = (char_u *)rep_buf
 
cmd uc_argt = argt
 
cmd uc_def = def
 
cmd uc_compl = compl
 
cmd uc_script_ctx = current_sctx
 
cmd uc_script_ctx sc_lnum = sourcing_lnum
 
nlua_set_sctxcmd
 
cmd uc_compl_arg = (char_u *)compl_arg
 
cmd uc_compl_luaref = compl_luaref
 
cmd uc_addr_type = addr_type
 
cmd uc_luaref = luaref
 
return OK
 
fail __pad0__
 
return FAIL
 

Macro Definition Documentation

◆ CURRENT_TAB_NR

#define CURRENT_TAB_NR   current_tab_nr(curtab)

◆ CURRENT_WIN_NR

#define CURRENT_WIN_NR   current_win_nr(curwin)

◆ ERROR

#define ERROR (   msg)
Value:
do { \
emsg(msg); \
goto end; \
} while (0)

◆ ESCAPE_CHARS

#define ESCAPE_CHARS   escape_chars

◆ ex_language

#define ex_language   ex_ni

◆ FREE_AENTRY_FNAME

#define FREE_AENTRY_FNAME (   arg)    xfree(arg->ae_fname)

◆ FREE_WCMD

#define FREE_WCMD (   wcmd)    xfree((wcmd)->line)

◆ IS_USER_CMDIDX

#define IS_USER_CMDIDX (   idx)    ((int)(idx) < 0)

◆ LAST_TAB_NR

#define LAST_TAB_NR   current_tab_nr(NULL)

◆ LAST_WIN_NR

#define LAST_WIN_NR   current_win_nr(NULL)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SPEC_PERC 
SPEC_HASH 
SPEC_CWORD 
SPEC_CCWORD 
SPEC_CEXPR 
SPEC_CFILE 
SPEC_SFILE 
SPEC_SLNUM 
SPEC_STACK 
SPEC_AFILE 
SPEC_ABUF 
SPEC_AMATCH 
SPEC_SFLNUM 
SPEC_SID 

Function Documentation

◆ alist_add()

void alist_add ( alist_T al,
char *  fname,
int  set_fnum 
)

Add file "fname" to argument list "al". "fname" must have been allocated and "al" must have been checked for room.

Parameters
set_fnum1: set buffer number; 2: re-use curbuf

◆ alist_clear()

void alist_clear ( alist_T al)

Clear an argument list: free all file names and reset it to zero entries.

◆ alist_expand()

void alist_expand ( int *  fnum_list,
int  fnum_len 
)

Expand the file names in the global argument list. If "fnum_list" is not NULL, use "fnum_list[fnum_len]" as a list of buffer numbers to be re-used.

◆ alist_init()

void alist_init ( alist_T al)

Init an argument list.

◆ alist_new()

void alist_new ( void  )

Create a new argument list and use it for the current window.

◆ alist_set()

void alist_set ( alist_T al,
int  count,
char **  files,
int  use_curbuf,
int *  fnum_list,
int  fnum_len 
)

Set the argument list for the current window. Takes over the allocated files[] and the allocated fnames in it.

◆ alist_unlink()

void alist_unlink ( alist_T al)

Remove a reference from an argument list. Ignored when the argument list is the global one. If the argument list is no longer used by any window, free it.

◆ before_quit_autocmds()

bool before_quit_autocmds ( win_T wp,
bool  quit_all,
bool  forceit 
)

◆ changedir_func()

bool changedir_func ( char *  new_dir,
CdScope  scope 
)

Change directory function used by :cd/:tcd/:lcd Ex commands and the chdir() function.

Parameters
new_dirThe directory to change to.
scopeScope of the function call (global, tab or window).
Returns
true if the directory is successfully changed.

◆ check_nextcmd()

char_u* check_nextcmd ( char_u p)

Check if *p is a separator between Ex commands, skipping over white space.

Returns
NULL if it isn't, the following character if it is.

◆ checkforcmd()

int checkforcmd ( char **  pp,
char *  cmd,
int  len 
)

Check for an Ex command with optional tail. If there is a match advance "pp" to the argument and return TRUE.

Parameters
ppstart of command
cmdname of command
lenrequired length

◆ cmd_can_preview()

bool cmd_can_preview ( char *  cmd)

Checks if cmd is "previewable" (i.e. supported by 'inccommand').

Parameters
[in]cmdCommandline to check. May start with a range or modifier.
Returns
true if cmd is previewable

◆ cmd_exists()

int cmd_exists ( const char *const  name)
Returns
> 0 if an Ex command "name" exists or, 2 if there is an exact match or, 3 if there is an ambiguous match.

◆ cmdcomplete_str_to_type()

int cmdcomplete_str_to_type ( const char *  complete_str)

◆ commands_array()

Dictionary commands_array ( buf_T buf)

Gets a map of maps describing user-commands defined for buffer buf or defined globally if buf is NULL.

Parameters
bufBuffer to inspect, or NULL to get global commands.
Returns
Map of maps describing commands

◆ dialog_msg()

void dialog_msg ( char *  buff,
char *  format,
char *  fname 
)

Make a dialog message in "buff[DIALOG_MSG_SIZE]". "format" must contain "%s".

◆ do_cmdline()

int do_cmdline ( char *  cmdline,
LineGetter  fgetline,
void cookie,
int  flags 
)

do_cmdline(): execute one Ex command line

  1. Execute "cmdline" when it is not NULL. If "cmdline" is NULL, or more lines are needed, fgetline() is used.
  2. Split up in parts separated with '|'.

This function can be called recursively!

flags: DOCMD_VERBOSE - The command will be included in the error message. DOCMD_NOWAIT - Don't call wait_return() and friends. DOCMD_REPEAT - Repeat execution until fgetline() returns NULL. DOCMD_KEYTYPED - Don't reset KeyTyped. DOCMD_EXCRESET - Reset the exception environment (used for debugging). DOCMD_KEEPLINE - Store first typed line (for repeating with "."). DOCMD_PREVIEW - During 'inccommand' preview.

Parameters
cookieargument for fgetline()
Returns
FAIL if cmdline could not be executed, OK otherwise

◆ do_cmdline_cmd()

int do_cmdline_cmd ( const char *  cmd)

Execute a simple command line. Used for translated commands like "*".

◆ do_exedit()

void do_exedit ( exarg_T eap,
win_T old_curwin 
)

":edit <file>" command and alike.

Parameters
old_curwincurwin before doing a split or NULL

◆ do_exmode()

void do_exmode ( void  )

Repeatedly get commands for Ex mode, until the ":vi" command is given.

◆ do_sleep()

void do_sleep ( long  msec)

Sleep for "msec" milliseconds, but keep checking for a CTRL-C every second.

◆ ends_excmd()

int ends_excmd ( int  c)

◆ eval_vars()

char_u* eval_vars ( char_u src,
char_u srcstart,
size_t *  usedlen,
linenr_T lnump,
char **  errormsg,
int *  escaped 
)

Evaluate cmdline variables.

change '' to curbuf->b_ffname '#' to curwin->w_alt_fnum '<cword>' to word under the cursor '<cWORD>' to WORD under the cursor '<cexpr>' to C-expression under the cursor '<cfile>' to path name under the cursor '<sfile>' to sourced file name '<slnum>' to sourced file line number '<afile>' to file name for autocommand '<abuf>' to buffer number for autocommand '<amatch>' to matching name for autocommand

When an error is detected, "errormsg" is set to a non-NULL pointer (may be "" for error without a message) and NULL is returned.

Parameters
srcpointer into commandline
srcstartbeginning of valid memory for src
usedlencharacters after src that are used
lnumpline number for :e command, or NULL
errormsgpointer to error message
escapedreturn value has escaped white space (can be NULL)
Returns
an allocated string if a valid match was found. Returns NULL if no match was found. "usedlen" then still contains the number of characters to skip.

◆ ex_all()

void ex_all ( exarg_T eap)

":all" and ":sall". Also used for ":tab drop file ..." after setting the argument list.

◆ ex_cd()

void ex_cd ( exarg_T eap)

":cd", ":tcd", ":lcd", ":chdir", "tchdir" and ":lchdir".

◆ ex_comclear()

void ex_comclear ( exarg_T eap)

":comclear" Clear all user commands, global and for current buffer.

◆ ex_errmsg()

char* ex_errmsg ( const char *const  msg,
const char *const  arg 
)
Returns
an error message with argument included. Uses a static buffer, only the last error will be kept. "msg" will be translated, caller should use N_().

◆ ex_may_print()

void ex_may_print ( exarg_T eap)

Print the current line if flags were given to the Ex command.

◆ ex_ni()

void ex_ni ( exarg_T eap)

Stub function for command which is Not Implemented. NI!

◆ ex_splitview()

void ex_splitview ( exarg_T eap)

:sview [+command] file split window with new file, read-only :split [[+command] file] split window with current or new file :vsplit [[+command] file] split window vertically with current or new file :new [[+command] file] split window with no or new file :vnew [[+command] file] split vertically window with no or new file :sfind [+command] file split window with file in 'path'

:tabedit open new Tab page with empty window :tabedit [+command] file open new Tab page and edit "file" :tabnew [[+command] file] just like :tabedit :tabfind [+command] file open new Tab page and find "file"

◆ ex_win_close()

void ex_win_close ( int  forceit,
win_T win,
tabpage_T tp 
)

Close window "win" and take care of handling closing the last window for a modified buffer.

Parameters
tpNULL or the tab page "win" is in

◆ exec_normal()

void exec_normal ( bool  was_typed)

Execute normal_cmd() until there is no typeahead left.

Parameters
was_typedwhether or not something was typed

◆ exec_normal_cmd()

void exec_normal_cmd ( char_u cmd,
int  remap,
bool  silent 
)

Execute normal mode command "cmd". "remap" can be REMAP_NONE or REMAP_YES.

◆ execute_cmd()

void execute_cmd ( exarg_T eap,
CmdParseInfo cmdinfo 
)

Execute an Ex command using parsed command line information. Does not do any validation of the Ex command arguments.

Parameters
eapEx-command arguments
cmdinfoCommand parse information

◆ expand_filename()

int expand_filename ( exarg_T eap,
char_u **  cmdlinep,
char **  errormsgp 
)

Expand file name in Ex command argument. When an error is detected, "errormsgp" is set to a non-NULL pointer.

Returns
FAIL for failure, OK otherwise.

◆ expand_sfile()

char* expand_sfile ( char *  arg)

Expand the <sfile> string in "arg".

Returns
an allocated string, or NULL for any error.

◆ f_fullcommand()

void f_fullcommand ( typval_T argvars,
typval_T rettv,
FunPtr  fptr 
)

"fullcommand" function

◆ filetype_maybe_enable()

void filetype_maybe_enable ( void  )

Enable filetype detection if the user did not explicitly disable it.

◆ filetype_plugin_enable()

void filetype_plugin_enable ( void  )

Source ftplugin.vim and indent.vim to create the necessary FileType autocommands. We do this separately from filetype.vim so that these autocommands will always fire first (and thus can be overridden) while still allowing general filetype detection to be disabled in the user's init file.

◆ find_cmdline_var()

ssize_t find_cmdline_var ( const char_u src,
size_t *  usedlen 
)

Check "str" for starting with a special cmdline variable. If found return one of the SPEC_ values and set "*usedlen" to the length of the variable. Otherwise return -1 and "*usedlen" is unchanged.

◆ find_ex_command()

char* find_ex_command ( exarg_T eap,
int *  full 
)

Find an Ex command by its name, either built-in or user. Start of the name can be found at eap->cmd. Sets eap->cmdidx and returns a pointer to char after the command name. "full" is set to TRUE if the whole command name matched.

Returns
NULL for an ambiguous user command.

◆ find_nextcmd()

char_u* find_nextcmd ( const char_u p)
Returns
the next command, after the first '|' or '
' or, NULL if not found.

◆ for()

for ( i  = 0; i < gap->ga_len; ++i)

◆ free_ucmd()

void free_ucmd ( ucmd_T cmd)

◆ get_bad_opt()

int get_bad_opt ( const char_u p,
exarg_T eap 
)

◆ get_behave_arg()

char* get_behave_arg ( expand_T xp,
int  idx 
)

Function given to ExpandGeneric() to obtain the possible arguments of the ":behave {mswin,xterm}" command.

◆ get_cmd_argt()

uint32_t get_cmd_argt ( cmdidx_T  cmdidx)

Get argt of command with id.

◆ get_cmd_default_range()

linenr_T get_cmd_default_range ( exarg_T eap)

Get default range number for command based on its address type.

◆ get_command_name()

char* get_command_name ( expand_T xp,
int  idx 
)

Function given to ExpandGeneric() to obtain the list of command names.

◆ get_mapclear_arg()

char* get_mapclear_arg ( expand_T *xp  FUNC_ATTR_UNUSED,
int  idx 
)

◆ get_messages_arg()

char* get_messages_arg ( expand_T *xp  FUNC_ATTR_UNUSED,
int  idx 
)

Function given to ExpandGeneric() to obtain the possible arguments of the ":messages {clear}" command.

◆ get_pressedreturn()

bool get_pressedreturn ( void  )

◆ get_user_cmd_addr_type()

char* get_user_cmd_addr_type ( expand_T xp,
int  idx 
)

Function given to ExpandGeneric() to obtain the list of user address type names.

◆ get_user_cmd_complete()

char* get_user_cmd_complete ( expand_T xp,
int  idx 
)

Function given to ExpandGeneric() to obtain the list of values for -complete.

◆ get_user_cmd_flags()

char* get_user_cmd_flags ( expand_T xp,
int  idx 
)

Function given to ExpandGeneric() to obtain the list of user command attributes.

◆ get_user_cmd_nargs()

char* get_user_cmd_nargs ( expand_T xp,
int  idx 
)

Function given to ExpandGeneric() to obtain the list of values for -nargs.

◆ get_user_commands()

char* get_user_commands ( expand_T *xp  FUNC_ATTR_UNUSED,
int  idx 
)

Function given to ExpandGeneric() to obtain the list of user command names.

◆ getline_cookie()

void* getline_cookie ( LineGetter  fgetline,
void cookie 
)

If "fgetline" is get_loop_line(), return the cookie used by the original getline function. Otherwise return "cookie".

Parameters
cookieargument for fgetline()

◆ getline_equal()

int getline_equal ( LineGetter  fgetline,
void cookie,
LineGetter  func 
)

If "fgetline" is get_loop_line(), return TRUE if the getline it uses equals "func". * Otherwise return TRUE when "fgetline" equals "func".

Parameters
cookieargument for fgetline()

◆ if() [1/3]

if ( cmp = 0)

◆ if() [2/3]

if ( flags &  UC_BUFFER)

◆ if() [3/3]

if ( rep_buf  = NULL)

◆ invalid_range()

char* invalid_range ( exarg_T eap)

Check range in Ex command for validity.

Returns
NULL when valid, error message when invalid.

◆ is_cmd_ni()

bool is_cmd_ni ( cmdidx_T  cmdidx)

Check if command is not implemented.

◆ is_loclist_cmd()

bool is_loclist_cmd ( int  cmdidx)
Returns
true if the supplied Ex cmdidx is for a location list command instead of a quickfix command.

◆ modifier_len()

int modifier_len ( char *  cmd)
Returns
length of a command modifier (including optional count) or, zero when it's not a modifier.

◆ NLUA_CLEAR_REF() [1/2]

NLUA_CLEAR_REF ( compl_luaref  )

◆ NLUA_CLEAR_REF() [2/2]

NLUA_CLEAR_REF ( luaref  )

◆ not_exiting()

void not_exiting ( void  )

Call this function if we thought we were going to exit, but we won't (because of an error). May need to restore the terminal mode.

◆ open_exfile()

FILE* open_exfile ( char_u fname,
int  forceit,
char *  mode 
)

Open a file for writing for an Ex command, with some checks.

Parameters
mode"w" for create new file or "a" for append
Returns
file descriptor, or NULL on failure.

◆ parse_addr_type_arg()

int parse_addr_type_arg ( char *  value,
int  vallen,
cmd_addr_T addr_type_arg 
)

Parse address type argument.

◆ parse_cmd_address()

int parse_cmd_address ( exarg_T eap,
char **  errormsg,
bool  silent 
)

Parse the address range, if any, in "eap". May set the last search pattern, unless "silent" is true.

Returns
FAIL and set "errormsg" or return OK.

◆ parse_cmdline()

bool parse_cmdline ( char *  cmdline,
exarg_T eap,
CmdParseInfo cmdinfo,
char **  errormsg 
)

Parse command line and return information about the first command.

Parameters
cmdlineCommand line string
[out]eapEx command arguments
[out]cmdinfoCommand parse information
[out]errormsgError message, if any
Returns
Success or failure

◆ parse_command_modifiers()

int parse_command_modifiers ( exarg_T eap,
char **  errormsg,
bool  skip_only 
)

Parse and skip over command modifiers:

  • update eap->cmd
  • store flags in "cmdmod".
  • Set ex_pressedreturn for an empty command line.
  • set msg_silent for ":silent"
  • set 'eventignore' to "all" for ":noautocmd"
  • set p_verbose for ":verbose"
  • Increment "sandbox" for ":sandbox"
Parameters
skip_onlyif true, the global variables are not changed, except for "cmdmod".
[out]errormsgpotential error message.
Returns
FAIL when the command is not to be executed.

◆ parse_compl_arg()

int parse_compl_arg ( const char *  value,
int  vallen,
int *  complp,
uint32_t *  argt,
char **  compl_arg 
)

Parse a completion argument "value[vallen]". The detected completion goes in "*complp", argument type in "*argt". When there is an argument, for function and user defined completion, it's copied to allocated memory and stored in "*compl_arg".

Returns
FAIL if something is wrong.

◆ replace_makeprg()

char* replace_makeprg ( exarg_T eap,
char *  p,
char **  cmdlinep 
)

For the ":make" and ":grep" commands insert the 'makeprg'/'grepprg' option in the command line, so that things like % get expanded.

◆ replace_termcodes()

replace_termcodes ( rep  ,
STRLEN(rep)  ,
rep_buf,
,
NULL  ,
CPO_TO_CPO_FLAGS   
)

◆ restore_current_state()

void restore_current_state ( save_state_T sst)

◆ save_current_state()

bool save_current_state ( save_state_T sst)

Save the current State and go to Normal mode.

Returns
true if the typeahead could be saved.

◆ separate_nextcmd()

void separate_nextcmd ( exarg_T eap)

Check for '|' to separate commands and '"' to start comments.

◆ set_cmd_addr_type()

void set_cmd_addr_type ( exarg_T eap,
char_u p 
)

Set the addr type for command

Parameters
ppointer to character after command name in cmdline

◆ set_cmd_count()

void set_cmd_count ( exarg_T eap,
long  count,
bool  validate 
)

◆ set_cmd_dflall_range()

void set_cmd_dflall_range ( exarg_T eap)

Set default command range for -range=% based on the addr type of the command.

◆ set_no_hlsearch()

void set_no_hlsearch ( bool  flag)

◆ set_one_cmd_context()

const char* set_one_cmd_context ( expand_T xp,
const char *  buff 
)

This is all pretty much copied from do_one_cmd(), with all the extra stuff we don't need/want deleted. Maybe this could be done better if we didn't repeat all this stuff. The only problem is that they may not stay perfectly compatible with each other, but then the command line syntax probably won't change that much – webb.

Parameters
buffbuffer for command string

◆ set_pressedreturn()

void set_pressedreturn ( bool  val)

◆ skip_range()

char* skip_range ( const char *  cmd,
int *  ctx 
)

Skip a range specifier of the form: addr [,addr] [;addr] ..

Backslashed delimiters after / or ? will be skipped, and commands will not be expanded between /'s and ?'s or after "'".

Also skip white space and ":" characters.

Parameters
ctxpointer to xp_context or NULL
Returns
the "cmd" pointer advanced to beyond the range.

◆ tabpage_close()

void tabpage_close ( int  forceit)

Close the current tab page.

◆ tabpage_close_other()

void tabpage_close_other ( tabpage_T tp,
int  forceit 
)

Close tab page "tp", which is not the current tab page. Note that autocommands may make "tp" invalid. Also takes care of the tab pages line disappearing when closing the last-but-one tab page.

◆ tabpage_new()

void tabpage_new ( void  )

Open a new tab page.

◆ uc_add_command()

int uc_add_command ( char *  name,
size_t  name_len,
char *  rep,
uint32_t  argt,
long  def,
int  flags,
int  compl,
char *  compl_arg,
LuaRef  compl_luaref,
cmd_addr_T  addr_type,
LuaRef  luaref,
bool  force 
)

◆ uc_clear()

void uc_clear ( garray_T gap)

Clear all user commands for "gap".

◆ uc_mods()

size_t uc_mods ( char *  buf)

◆ uc_split_args_iter()

bool uc_split_args_iter ( const char *  arg,
size_t  arglen,
size_t *  end,
char *  buf,
size_t *  len 
)

Split a string by unescaped whitespace (space & tab), used for f-args on Lua commands callback. Similar to uc_split_args(), but does not allocate, add quotes, add commas and is an iterator.

Parameters
[in]argString to split
[in]arglenLength of {arg}
[in,out]endIndex of last character of previous iteration
[out]bufBuffer to copy string into
[out]lenLength of string in {buf}
Returns
true if iteration is complete, else false

◆ uc_validate_name()

char* uc_validate_name ( char *  name)

Check for a valid user command name

If the given {name} is valid, then a pointer to the end of the valid name is returned. Otherwise, returns NULL.

◆ update_topline_cursor()

void update_topline_cursor ( void  )

Update w_topline, w_leftcol and the cursor position.

◆ verify_command()

void verify_command ( char *  cmd)

◆ vim_mkdir_emsg()

int vim_mkdir_emsg ( const char *const  name,
const int  prot 
)

Try creating a directory, give error message on failure

Parameters
[in]nameDirectory to create.
[in]protDirectory permissions.
Returns
OK in case of success, FAIL otherwise.

◆ xfree()

xfree ( compl_arg  )

Variable Documentation

◆ __pad0__

fail __pad0__

◆ cmd

◆ cmp

int cmp = 1

◆ else

else
Initial value:
{

◆ expand

◆ FAIL

return FAIL

◆ gap

garray_T* gap

◆ i

int int i
Initial value:

◆ name

char* name

◆ OK

return OK

◆ rep_buf

char* rep_buf = NULL

◆ sc_lnum

◆ shortname

char* shortname

◆ uc_addr_type

cmd uc_addr_type = addr_type

◆ uc_argt

cmd uc_argt = argt

◆ uc_compl

cmd uc_compl = compl

◆ uc_compl_arg

cmd uc_compl_arg = (char_u *)compl_arg

◆ uc_compl_luaref

cmd uc_compl_luaref = compl_luaref

◆ uc_def

cmd uc_def = def

◆ uc_luaref

cmd uc_luaref = luaref

◆ uc_rep

cmd uc_rep = (char_u *)rep_buf

◆ uc_script_ctx

cmd uc_script_ctx = current_sctx

◆ ucmds

garray_T ucmds = { 0, 0, sizeof(ucmd_T), 4, NULL }
cmd
nlua_set_sctx & cmd
Definition: ex_docmd.c:5611
gap
garray_T * gap
Definition: ex_docmd.c:5534
ucmds
garray_T ucmds
Definition: ex_docmd.c:91
msg
err msg
Definition: helpers.c:1110
NULL
return NULL
Definition: eval.c:9968
end
const char_u *const end
Definition: keycodes.c:627
ucmd
Definition: ex_docmd.h:36