Data Structures | Macros | Typedefs | Functions
ex_docmd.c File Reference
#include <assert.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include <inttypes.h>
#include "nvim/vim.h"
#include "nvim/ascii.h"
#include "nvim/ex_docmd.h"
#include "nvim/buffer.h"
#include "nvim/change.h"
#include "nvim/charset.h"
#include "nvim/cursor.h"
#include "nvim/diff.h"
#include "nvim/digraph.h"
#include "nvim/edit.h"
#include "nvim/eval.h"
#include "nvim/ex_cmds.h"
#include "nvim/ex_cmds2.h"
#include "nvim/ex_eval.h"
#include "nvim/ex_getln.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"
#include "nvim/func_attr.h"
#include "nvim/getchar.h"
#include "nvim/hardcopy.h"
#include "nvim/if_cscope.h"
#include "nvim/main.h"
#include "nvim/mark.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/menu.h"
#include "nvim/message.h"
#include "nvim/misc1.h"
#include "nvim/ex_session.h"
#include "nvim/keymap.h"
#include "nvim/file_search.h"
#include "nvim/garray.h"
#include "nvim/move.h"
#include "nvim/normal.h"
#include "nvim/ops.h"
#include "nvim/option.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/sign.h"
#include "nvim/spell.h"
#include "nvim/spellfile.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/version.h"
#include "nvim/window.h"
#include "nvim/os/os.h"
#include "nvim/os/input.h"
#include "nvim/os/time.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/mouse.h"
#include "nvim/event/rstream.h"
#include "nvim/event/wstream.h"
#include "nvim/shada.h"
#include "nvim/lua/executor.h"
#include "nvim/globals.h"
#include "nvim/api/private/helpers.h"

Data Structures

struct  ucmd
 
struct  wcmd_T
 
struct  loop_cookie
 
struct  dbg_stuff
 
struct  parse_state_T
 
struct  cmdmod
 

Macros

#define UC_BUFFER   1 /* -buffer: local to current buffer */
 
#define USER_CMD(i)   (&((ucmd_T *)(ucmds.ga_data))[i])
 
#define USER_CMD_GA(gap, i)   (&((ucmd_T *)((gap)->ga_data))[i])
 
#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 ESCAPE_CHARS   escape_chars
 
#define FREE_AENTRY_FNAME(arg)   xfree(arg->ae_fname)
 
#define SPEC_PERC   0
 
#define SPEC_HASH   (SPEC_PERC + 1)
 
#define SPEC_CWORD   (SPEC_HASH + 1)
 
#define SPEC_CCWORD   (SPEC_CWORD + 1)
 
#define SPEC_CEXPR   (SPEC_CCWORD + 1)
 
#define SPEC_CFILE   (SPEC_CEXPR + 1)
 
#define SPEC_SFILE   (SPEC_CFILE + 1)
 
#define SPEC_SLNUM   (SPEC_SFILE + 1)
 
#define SPEC_AFILE   (SPEC_SLNUM + 1)
 
#define SPEC_ABUF   (SPEC_AFILE + 1)
 
#define SPEC_AMATCH   (SPEC_ABUF + 1)
 
#define SPEC_SFLNUM   (SPEC_AMATCH + 1)
 

Typedefs

typedef struct ucmd ucmd_T
 

Functions

void do_exmode (int improved)
 Repeatedly get commands for Ex mode, until the ":vi" command is given. More...
 
int do_cmdline_cmd (const char *cmd)
 
int do_cmdline (char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
 
int getline_equal (LineGetter fgetline, void *cookie, LineGetter func)
 
voidgetline_cookie (LineGetter fgetline, void *cookie)
 
int parse_cmd_address (exarg_T *eap, char_u **errormsg) FUNC_ATTR_NONNULL_ALL
 
int checkforcmd (char_u **pp, char *cmd, int len)
 
int modifier_len (char_u *cmd)
 
int cmd_exists (const char *const name)
 
const char * set_one_cmd_context (expand_T *xp, const char *buff)
 
char_uskip_range (const char_u *cmd, int *ctx)
 
void ex_ni (exarg_T *eap)
 Stub function for command which is Not Implemented. NI! More...
 
int expand_filename (exarg_T *eap, char_u **cmdlinep, char_u **errormsgp)
 
void separate_nextcmd (exarg_T *eap)
 
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_uget_command_name (expand_T *xp, int idx)
 
void ex_comclear (exarg_T *eap)
 
void uc_clear (garray_T *gap)
 
char_uget_user_cmd_addr_type (expand_T *xp, int idx)
 
char_uget_user_commands (expand_T *xp FUNC_ATTR_UNUSED, int idx) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
 
char_uget_user_cmd_flags (expand_T *xp, int idx)
 
char_uget_user_cmd_nargs (expand_T *xp, int idx)
 
char_uget_user_cmd_complete (expand_T *xp, int idx)
 
int parse_addr_type_arg (char_u *value, int vallen, uint32_t *argt, int *addr_type_arg)
 
int parse_compl_arg (const char_u *value, int vallen, int *complp, uint32_t *argt, char_u **compl_arg)
 
int cmdcomplete_str_to_type (char_u *complete_str)
 
void not_exiting (void)
 
void ex_win_close (int forceit, win_T *win, tabpage_T *tp)
 
void tabpage_close (int forceit)
 
void tabpage_close_other (tabpage_T *tp, int forceit)
 
void ex_all (exarg_T *eap)
 
void alist_clear (alist_T *al)
 
void alist_init (alist_T *al)
 
void alist_unlink (alist_T *al)
 
void alist_new (void)
 
void alist_expand (int *fnum_list, int fnum_len)
 
void alist_set (alist_T *al, int count, char_u **files, int use_curbuf, int *fnum_list, int fnum_len)
 
void alist_add (alist_T *al, char_u *fname, int set_fnum)
 
void ex_splitview (exarg_T *eap)
 
void tabpage_new (void)
 
void do_exedit (exarg_T *eap, win_T *old_curwin)
 
void post_chdir (CdScope scope, bool trigger_dirchanged)
 
void ex_cd (exarg_T *eap)
 :cd, :tcd, :lcd, :chdir, :tchdir and :lchdir. More...
 
void do_sleep (long msec)
 
void ex_may_print (exarg_T *eap)
 
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)
 
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_u **errormsg, int *escaped)
 
char_uexpand_sfile (char_u *arg)
 
void dialog_msg (char_u *buff, char *format, char_u *fname)
 
char_uget_behave_arg (expand_T *xp, int idx)
 
char_uget_messages_arg (expand_T *xp FUNC_ATTR_UNUSED, int idx)
 
char_uget_mapclear_arg (expand_T *xp FUNC_ATTR_UNUSED, int idx)
 
void filetype_maybe_enable (void)
 Set all :filetype options ON if user did not explicitly set any to OFF. 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_u *cmd)
 
Dictionary commands_array (buf_T *buf)
 

Macro Definition Documentation

#define CURRENT_TAB_NR   current_tab_nr(curtab)
#define CURRENT_WIN_NR   current_win_nr(curwin)
#define ESCAPE_CHARS   escape_chars
#define ex_language   ex_ni
#define FREE_AENTRY_FNAME (   arg)    xfree(arg->ae_fname)
#define FREE_WCMD (   wcmd)    xfree((wcmd)->line)
#define IS_USER_CMDIDX (   idx)    ((int)(idx) < 0)
#define LAST_TAB_NR   current_tab_nr(NULL)
#define LAST_WIN_NR   current_win_nr(NULL)
#define SPEC_ABUF   (SPEC_AFILE + 1)
#define SPEC_AFILE   (SPEC_SLNUM + 1)
#define SPEC_AMATCH   (SPEC_ABUF + 1)
#define SPEC_CCWORD   (SPEC_CWORD + 1)
#define SPEC_CEXPR   (SPEC_CCWORD + 1)
#define SPEC_CFILE   (SPEC_CEXPR + 1)
#define SPEC_CWORD   (SPEC_HASH + 1)
#define SPEC_HASH   (SPEC_PERC + 1)
#define SPEC_PERC   0
#define SPEC_SFILE   (SPEC_CFILE + 1)
#define SPEC_SFLNUM   (SPEC_AMATCH + 1)
#define SPEC_SLNUM   (SPEC_SFILE + 1)
#define UC_BUFFER   1 /* -buffer: local to current buffer */
#define USER_CMD (   i)    (&((ucmd_T *)(ucmds.ga_data))[i])
#define USER_CMD_GA (   gap,
  i 
)    (&((ucmd_T *)((gap)->ga_data))[i])

Typedef Documentation

typedef struct ucmd ucmd_T

Function Documentation

void alist_add ( alist_T al,
char_u fname,
int  set_fnum 
)
void alist_clear ( alist_T al)
void alist_expand ( int *  fnum_list,
int  fnum_len 
)
void alist_init ( alist_T al)
void alist_new ( void  )
void alist_set ( alist_T al,
int  count,
char_u **  files,
int  use_curbuf,
int *  fnum_list,
int  fnum_len 
)
void alist_unlink ( alist_T al)
char_u* check_nextcmd ( char_u p)

Check if *p is a separator between Ex commands, skipping over white space. Return NULL if it isn't, the following character if it is.

int checkforcmd ( char_u **  pp,
char *  cmd,
int  len 
)
bool cmd_can_preview ( char_u 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
int cmd_exists ( const char *const  name)
int cmdcomplete_str_to_type ( char_u complete_str)
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
void dialog_msg ( char_u buff,
char *  format,
char_u fname 
)
int do_cmdline ( char_u 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 ".").

Returns
FAIL if cmdline could not be executed, OK otherwise
int do_cmdline_cmd ( const char *  cmd)
void do_exedit ( exarg_T eap,
win_T old_curwin 
)
void do_exmode ( int  improved)

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

void do_sleep ( long  msec)
int ends_excmd ( int  c)
char_u* eval_vars ( char_u src,
char_u srcstart,
size_t *  usedlen,
linenr_T lnump,
char_u **  errormsg,
int *  escaped 
)
void ex_all ( exarg_T eap)
void ex_cd ( exarg_T eap)

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

void ex_comclear ( exarg_T eap)
void ex_may_print ( exarg_T eap)
void ex_ni ( exarg_T eap)

Stub function for command which is Not Implemented. NI!

void ex_splitview ( exarg_T eap)
void ex_win_close ( int  forceit,
win_T win,
tabpage_T tp 
)
void exec_normal ( bool  was_typed)

Execute normal_cmd() until there is no typeahead left.

Parameters
was_typedwhether or not something was typed
void exec_normal_cmd ( char_u cmd,
int  remap,
bool  silent 
)
int expand_filename ( exarg_T eap,
char_u **  cmdlinep,
char_u **  errormsgp 
)
char_u* expand_sfile ( char_u arg)
void filetype_maybe_enable ( void  )

Set all :filetype options ON if user did not explicitly set any to OFF.

ssize_t find_cmdline_var ( const char_u src,
size_t *  usedlen 
)
char_u* find_nextcmd ( const char_u p)
int get_bad_opt ( const char_u p,
exarg_T eap 
)
char_u* get_behave_arg ( expand_T xp,
int  idx 
)
char_u* get_command_name ( expand_T xp,
int  idx 
)
char_u* get_mapclear_arg ( expand_T *xp  FUNC_ATTR_UNUSED,
int  idx 
)
char_u* get_messages_arg ( expand_T *xp  FUNC_ATTR_UNUSED,
int  idx 
)
bool get_pressedreturn ( void  )
char_u* get_user_cmd_addr_type ( expand_T xp,
int  idx 
)
char_u* get_user_cmd_complete ( expand_T xp,
int  idx 
)
char_u* get_user_cmd_flags ( expand_T xp,
int  idx 
)
char_u* get_user_cmd_nargs ( expand_T xp,
int  idx 
)
char_u* get_user_commands ( expand_T *xp  FUNC_ATTR_UNUSED,
int  idx 
)
void* getline_cookie ( LineGetter  fgetline,
void cookie 
)
int getline_equal ( LineGetter  fgetline,
void cookie,
LineGetter  func 
)
bool is_loclist_cmd ( int  cmdidx)
int modifier_len ( char_u cmd)
void not_exiting ( void  )
FILE* open_exfile ( char_u fname,
int  forceit,
char *  mode 
)
int parse_addr_type_arg ( char_u value,
int  vallen,
uint32_t *  argt,
int *  addr_type_arg 
)
int parse_cmd_address ( exarg_T eap,
char_u **  errormsg 
)
int parse_compl_arg ( const char_u value,
int  vallen,
int *  complp,
uint32_t *  argt,
char_u **  compl_arg 
)
void post_chdir ( CdScope  scope,
bool  trigger_dirchanged 
)

Deal with the side effects of changing the current directory.

Parameters
scopeScope of the function call (global, tab or window).
void separate_nextcmd ( exarg_T eap)
void set_no_hlsearch ( bool  flag)
const char* set_one_cmd_context ( expand_T xp,
const char *  buff 
)
void set_pressedreturn ( bool  val)
char_u* skip_range ( const char_u cmd,
int *  ctx 
)
void tabpage_close ( int  forceit)
void tabpage_close_other ( tabpage_T tp,
int  forceit 
)
void tabpage_new ( void  )
void uc_clear ( garray_T gap)
void update_topline_cursor ( void  )
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.

Variable Documentation

int expand
char* name