#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <stdbool.h>
#include <string.h>
#include "nvim/ascii.h"
#include "nvim/globals.h"
#include "nvim/vim.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/buffer.h"
#include "nvim/change.h"
#include "nvim/charset.h"
#include "nvim/debugger.h"
#include "nvim/eval/userfunc.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/garray.h"
#include "nvim/lua/executor.h"
#include "nvim/mark.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/move.h"
#include "nvim/normal.h"
#include "nvim/ops.h"
#include "nvim/option.h"
#include "nvim/os/fs_defs.h"
#include "nvim/os/input.h"
#include "nvim/os/shell.h"
#include "nvim/os_unix.h"
#include "nvim/path.h"
#include "nvim/profile.h"
#include "nvim/quickfix.h"
#include "nvim/regexp.h"
#include "nvim/strings.h"
#include "nvim/undo.h"
#include "nvim/version.h"
#include "nvim/window.h"
Data Structures | |
struct | sn_prl_S |
struct | source_cookie |
struct | GetBufferLineCookie |
struct | GetStrLineCookie |
Macros | |
#define | SCRIPT_ITEM(id) (((scriptitem_T *)script_items.ga_data)[(id) - 1]) |
#define | PRL_ITEM(si, idx) (((sn_prl_T *)(si)->sn_prl_ga.ga_data)[(idx)]) |
#define | AL_SET 1 |
Code to handle the argument list. More... | |
#define | AL_ADD 2 |
#define | AL_DEL 3 |
Typedefs | |
typedef struct sn_prl_S | sn_prl_T |
Enumerations | |
enum | { PEXP_SUBCMD, PEXP_FUNC } |
Functions | |
void | ex_profile (exarg_T *eap) |
":profile cmd args" More... | |
void | ex_ruby (exarg_T *eap) |
void | ex_rubyfile (exarg_T *eap) |
void | ex_rubydo (exarg_T *eap) |
void | ex_python3 (exarg_T *eap) |
void | ex_py3file (exarg_T *eap) |
void | ex_pydo3 (exarg_T *eap) |
void | ex_perl (exarg_T *eap) |
void | ex_perlfile (exarg_T *eap) |
void | ex_perldo (exarg_T *eap) |
char * | get_profile_name (expand_T *xp, int idx) FUNC_ATTR_PURE |
void | set_context_in_profile_cmd (expand_T *xp, const char *arg) |
Handle command line completion for :profile command. More... | |
void | profile_dump (void) |
Dump the profiling info. More... | |
void | script_prof_save (proftime_T *tm) |
void | script_prof_restore (proftime_T *tm) |
Count time spent in children after invoking another script or function. More... | |
void | prof_inchar_enter (void) |
Called when starting to wait for the user to type a character. More... | |
void | prof_inchar_exit (void) |
Called when finished waiting for the user to type a character. More... | |
bool | prof_def_func (void) |
int | autowrite (buf_T *buf, int forceit) |
void | autowrite_all (void) |
Flush all buffers, except the ones that are readonly or are never written. More... | |
bool | check_changed (buf_T *buf, int flags) |
void | dialog_changed (buf_T *buf, bool checkall) |
bool | dialog_close_terminal (buf_T *buf) |
bool | can_abandon (buf_T *buf, int forceit) |
bool | check_changed_any (bool hidden, bool unload) |
int | check_fname (void) |
int | buf_write_all (buf_T *buf, int forceit) |
int | get_arglist_exp (char_u *str, int *fcountp, char_u ***fnamesp, bool wig) |
void | check_arg_idx (win_T *win) |
Check if window "win" is editing the w_arg_idx file in its argument list. More... | |
void | ex_args (exarg_T *eap) |
":args", ":argslocal" and ":argsglobal". More... | |
void | ex_previous (exarg_T *eap) |
":previous", ":sprevious", ":Next" and ":sNext". More... | |
void | ex_rewind (exarg_T *eap) |
":rewind", ":first", ":sfirst" and ":srewind". More... | |
void | ex_last (exarg_T *eap) |
":last" and ":slast". More... | |
void | ex_argument (exarg_T *eap) |
":argument" and ":sargument". More... | |
void | do_argfile (exarg_T *eap, int argn) |
Edit file "argn" of the argument lists. More... | |
void | ex_next (exarg_T *eap) |
":next", and commands that behave like it. More... | |
void | ex_argedit (exarg_T *eap) |
":argedit" More... | |
void | ex_argadd (exarg_T *eap) |
":argadd" More... | |
void | ex_argdelete (exarg_T *eap) |
":argdelete" More... | |
void | ex_listdo (exarg_T *eap) |
":argdo", ":windo", ":bufdo", ":tabdo", ":cdo", ":ldo", ":cfdo" and ":lfdo" More... | |
char * | get_arglist_name (expand_T *xp FUNC_ATTR_UNUSED, int idx) |
void | ex_compiler (exarg_T *eap) |
":compiler[!] {name}" More... | |
void | ex_options (exarg_T *eap) |
":options" More... | |
void | ex_source (exarg_T *eap) |
":source [{fname}]" More... | |
linenr_T * | source_breakpoint (void *cookie) |
int * | source_dbg_tick (void *cookie) |
int | source_level (void *cookie) FUNC_ATTR_PURE |
scriptitem_T * | new_script_item (char *const name, scid_T *const sid_out) |
int | do_source_str (const char *cmd, const char *traceback_name) |
int | do_source (char *fname, int check_other, int is_vimrc) |
scriptitem_T * | get_current_script_id (char_u *fname, sctx_T *ret_sctx) |
void | ex_scriptnames (exarg_T *eap) |
":scriptnames" More... | |
char_u * | get_scriptname (LastSet last_set, bool *should_free) |
linenr_T | get_sourced_lnum (LineGetter fgetline, void *cookie) FUNC_ATTR_PURE |
char * | getsourceline (int c, void *cookie, int indent, bool do_concat) |
void | script_line_start (void) |
void | script_line_exec (void) |
Called when actually executing a function line. More... | |
void | script_line_end (void) |
Called when done with a function line. More... | |
void | ex_scriptencoding (exarg_T *eap) |
void | ex_finish (exarg_T *eap) |
":finish": Mark a sourced file as finished. More... | |
void | do_finish (exarg_T *eap, int reanimate) |
bool | source_finished (LineGetter fgetline, void *cookie) |
void | ex_checktime (exarg_T *eap) |
":checktime [buffer]" More... | |
char * | get_mess_lang (void) |
void | set_lang_var (void) |
void | ex_drop (exarg_T *eap) |
Some more functions for command line commands
#define AL_ADD 2 |
#define AL_DEL 3 |
#define AL_SET 1 |
Code to handle the argument list.
#define PRL_ITEM | ( | si, | |
idx | |||
) | (((sn_prl_T *)(si)->sn_prl_ga.ga_data)[(idx)]) |
#define SCRIPT_ITEM | ( | id | ) | (((scriptitem_T *)script_items.ga_data)[(id) - 1]) |
anonymous enum |
int autowrite | ( | buf_T * | buf, |
int | forceit | ||
) |
If 'autowrite' option set, try to write the file. Careful: autocommands may make "buf" invalid!
Flush all buffers, except the ones that are readonly or are never written.
int buf_write_all | ( | buf_T * | buf, |
int | forceit | ||
) |
Flush the contents of a buffer, unless it has no file name.
Check if window "win" is editing the w_arg_idx file in its argument list.
Check if any buffer was changed and cannot be abandoned. That changed buffer becomes the current buffer. When "unload" is true the current buffer is unloaded instead of making it hidden. This is used for ":q!".
[in] | hidden | specifies whether to check only hidden buffers. |
[in] | unload | specifies whether to unload, instead of hide, the buffer. |
int check_fname | ( | void | ) |
Ask the user what to do when abandoning a changed buffer. Must check 'write' option first!
buf | |
checkall | may abandon all changed buffers |
Ask the user whether to close the terminal buffer or not.
buf | The terminal buffer. |
Mark a sourced file as finished. Possibly makes the ":finish" pending. Also called for a pending finish at the ":endtry" or after returning from an extra do_cmdline(). "reanimate" is used in the latter case.
int do_source | ( | char * | fname, |
int | check_other, | ||
int | is_vimrc | ||
) |
When fname is a 'lua' file nlua_exec_file() is invoked to source it. Otherwise reads the file fname
and executes its lines as Ex commands.
This function may be called recursively!
fname | |
check_other | check for .vimrc and _vimrc |
is_vimrc | DOSO_ value |
int do_source_str | ( | const char * | cmd, |
const char * | traceback_name | ||
) |
Executes lines in src
as Ex commands.
":drop" Opens the first argument in a window. When there are two or more arguments the argument list is redefined.
":argdo", ":windo", ":bufdo", ":tabdo", ":cdo", ":ldo", ":cfdo" and ":lfdo"
":scriptencoding": Set encoding conversion for a sourced script. Without the multi-byte feature it's simply ignored.
Parse a list of arguments (file names), expand them and return in "fnames[fcountp]". When "wig" is true, removes files matching 'wildignore'.
char* get_arglist_name | ( | expand_T *xp | FUNC_ATTR_UNUSED, |
int | idx | ||
) |
scriptitem_T* get_current_script_id | ( | char_u * | fname, |
sctx_T * | ret_sctx | ||
) |
Check if fname was sourced before to finds its SID. If it's new, generate a new SID.
[in] | fname | file path of script |
[out] | ret_sctx | sctx of this script |
char* get_mess_lang | ( | void | ) |
Obtain the current messages language. Used to set the default for 'helplang'. May return NULL or an empty string.
char* get_profile_name | ( | expand_T * | xp, |
int | idx | ||
) |
Function given to ExpandGeneric() to obtain the profile command specific expansion.
Get a pointer to a script name. Used for ":verbose set". Message appended to "Last set from "
linenr_T get_sourced_lnum | ( | LineGetter | fgetline, |
void * | cookie | ||
) |
Get one full line from a sourced file. Called by do_cmdline() when it's called from do_source().
scriptitem_T* new_script_item | ( | char *const | name, |
scid_T *const | sid_out | ||
) |
Create a new script item and allocate script-local vars.
name | File name of the script. NULL for anonymous :source. | |
[out] | sid_out | SID of the new item. |
Called when starting to read a script line. "sourcing_lnum" must be correct! When skipping lines it may not actually be executed, but we won't find out until later and we need to store the time now.
void script_prof_restore | ( | proftime_T * | tm | ) |
Count time spent in children after invoking another script or function.
void script_prof_save | ( | proftime_T * | tm | ) |
Save time when starting to invoke another script or function.
tm | place to store wait time |
Handle command line completion for :profile command.
Set the "v:lang" variable according to the current locale setting. Also do "v:lc_time"and "v:ctype".
":source" and associated commands.
int* source_dbg_tick | ( | void * | cookie | ) |
bool source_finished | ( | LineGetter | fgetline, |
void * | cookie | ||
) |
int source_level | ( | void * | cookie | ) |