refactor: move cmdline completion types to cmdexpand_defs.h (#25465)

This commit is contained in:
zeertzjq 2023-10-02 10:45:33 +08:00 committed by GitHub
parent 9ce1623837
commit 09a17f91d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
61 changed files with 246 additions and 189 deletions

View File

@ -192,6 +192,7 @@
# of its behavior.
{ include: [ '"nvim/arglist_defs.h"', public, '"nvim/arglist.h"', public ] },
{ include: [ '"nvim/buffer_defs.h"', public, '"nvim/buffer.h"', public ] },
{ include: [ '"nvim/cmdexpand_defs.h"', public, '"nvim/cmdexpand.h"', public ] },
{ include: [ '"nvim/eval/typval_defs.h"', public, '"nvim/eval/typval.h"', public ] },
{ include: [ '"nvim/ex_cmds_defs.h"', public, '"nvim/ex_cmds.h"', public ] },
{ include: [ '"nvim/ex_eval_defs.h"', public, '"nvim/ex_eval.h"', public ] },

View File

@ -17,6 +17,7 @@
#include "nvim/ascii.h"
#include "nvim/autocmd.h"
#include "nvim/buffer_defs.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/decoration.h"
#include "nvim/ex_cmds.h"
#include "nvim/ex_docmd.h"

View File

@ -14,6 +14,7 @@
#include "nvim/autocmd.h"
#include "nvim/buffer.h"
#include "nvim/charset.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/eval/typval.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/eval/window.h"

View File

@ -2,6 +2,7 @@
#define NVIM_ARGLIST_H
#include "nvim/arglist_defs.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/types.h"

View File

@ -6,6 +6,7 @@
#include "nvim/api/private/defs.h"
#include "nvim/buffer_defs.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/macros.h"

View File

@ -1,6 +1,7 @@
#ifndef NVIM_CMDEXPAND_H
#define NVIM_CMDEXPAND_H
#include "nvim/cmdexpand_defs.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_getln.h"
#include "nvim/garray.h"
@ -41,9 +42,6 @@ enum {
BUF_DIFF_FILTER = 0x2000,
};
/// Type used by ExpandGeneric()
typedef char *(*CompleteListItemGetter)(expand_T *, int);
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "cmdexpand.h.generated.h"
#endif

113
src/nvim/cmdexpand_defs.h Normal file
View File

@ -0,0 +1,113 @@
#ifndef NVIM_CMDEXPAND_DEFS_H
#define NVIM_CMDEXPAND_DEFS_H
#include <stdbool.h>
#include <stddef.h>
#include "nvim/eval/typval_defs.h"
#include "nvim/types.h"
typedef enum {
XP_PREFIX_NONE, ///< prefix not used
XP_PREFIX_NO, ///< "no" prefix for bool option
XP_PREFIX_INV, ///< "inv" prefix for bool option
} xp_prefix_T;
enum { EXPAND_BUF_LEN = 256, };
/// used for completion on the command line
typedef struct expand {
char *xp_pattern; ///< start of item to expand
int xp_context; ///< type of expansion
size_t xp_pattern_len; ///< bytes in xp_pattern before cursor
xp_prefix_T xp_prefix;
char *xp_arg; ///< completion function
LuaRef xp_luaref; ///< Ref to Lua completion function
sctx_T xp_script_ctx; ///< SCTX for completion function
int xp_backslash; ///< one of the XP_BS_ values
#ifndef BACKSLASH_IN_FILENAME
bool xp_shell; ///< true for a shell command, more
///< characters need to be escaped
#endif
int xp_numfiles; ///< number of files found by file name completion
int xp_col; ///< cursor position in line
int xp_selected; ///< selected index in completion
char *xp_orig; ///< originally expanded string
char **xp_files; ///< list of files
char *xp_line; ///< text being completed
char xp_buf[EXPAND_BUF_LEN]; ///< buffer for returned match
} expand_T;
/// values for xp_backslash
enum {
XP_BS_NONE = 0, ///< nothing special for backslashes
XP_BS_ONE = 1, ///< uses one backslash before a space
XP_BS_THREE = 2, ///< uses three backslashes before a space
};
/// values for xp_context when doing command line completion
enum {
EXPAND_UNSUCCESSFUL = -2,
EXPAND_OK = -1,
EXPAND_NOTHING = 0,
EXPAND_COMMANDS,
EXPAND_FILES,
EXPAND_DIRECTORIES,
EXPAND_SETTINGS,
EXPAND_BOOL_SETTINGS,
EXPAND_TAGS,
EXPAND_OLD_SETTING,
EXPAND_HELP,
EXPAND_BUFFERS,
EXPAND_EVENTS,
EXPAND_MENUS,
EXPAND_SYNTAX,
EXPAND_HIGHLIGHT,
EXPAND_AUGROUP,
EXPAND_USER_VARS,
EXPAND_MAPPINGS,
EXPAND_TAGS_LISTFILES,
EXPAND_FUNCTIONS,
EXPAND_USER_FUNC,
EXPAND_EXPRESSION,
EXPAND_MENUNAMES,
EXPAND_USER_COMMANDS,
EXPAND_USER_CMD_FLAGS,
EXPAND_USER_NARGS,
EXPAND_USER_COMPLETE,
EXPAND_ENV_VARS,
EXPAND_LANGUAGE,
EXPAND_COLORS,
EXPAND_COMPILER,
EXPAND_USER_DEFINED,
EXPAND_USER_LIST,
EXPAND_USER_LUA,
EXPAND_SHELLCMD,
EXPAND_SIGN,
EXPAND_PROFILE,
EXPAND_FILETYPE,
EXPAND_FILES_IN_PATH,
EXPAND_OWNSYNTAX,
EXPAND_LOCALES,
EXPAND_HISTORY,
EXPAND_USER,
EXPAND_SYNTIME,
EXPAND_USER_ADDR_TYPE,
EXPAND_PACKADD,
EXPAND_MESSAGES,
EXPAND_MAPCLEAR,
EXPAND_ARGLIST,
EXPAND_DIFF_BUFFERS,
EXPAND_BREAKPOINT,
EXPAND_SCRIPTNAMES,
EXPAND_RUNTIME,
EXPAND_STRING_SETTING,
EXPAND_SETTING_SUBTRACT,
EXPAND_CHECKHEALTH,
EXPAND_LUA,
};
/// Type used by ExpandGeneric()
typedef char *(*CompleteListItemGetter)(expand_T *, int);
#endif // NVIM_CMDEXPAND_DEFS_H

View File

@ -12,6 +12,7 @@
#include "nvim/ascii.h"
#include "nvim/charset.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/cmdhist.h"
#include "nvim/eval/typval.h"
#include "nvim/ex_cmds.h"

View File

@ -1,6 +1,7 @@
#ifndef NVIM_CMDHIST_H
#define NVIM_CMDHIST_H
#include "nvim/cmdexpand_defs.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/os/time.h"

View File

@ -12,6 +12,7 @@
#include "nvim/ascii.h"
#include "nvim/charset.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/debugger.h"
#include "nvim/drawscreen.h"
#include "nvim/eval.h"

View File

@ -21,6 +21,7 @@
#include "nvim/buffer_defs.h"
#include "nvim/channel.h"
#include "nvim/charset.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/cmdhist.h"
#include "nvim/cursor.h"
#include "nvim/edit.h"

View File

@ -6,6 +6,7 @@
#include "nvim/buffer_defs.h"
#include "nvim/channel.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/event/time.h"
#include "nvim/ex_cmds_defs.h"

View File

@ -33,6 +33,7 @@
#include "nvim/channel.h"
#include "nvim/charset.h"
#include "nvim/cmdexpand.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/context.h"
#include "nvim/cursor.h"
#include "nvim/diff.h"

View File

@ -6,6 +6,7 @@
#include "nvim/api/private/dispatch.h"
#include "nvim/buffer_defs.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/types.h"

View File

@ -115,6 +115,19 @@ typedef enum {
VAR_BLOB, ///< Blob, .v_blob is used.
} VarType;
/// Type values for type().
enum {
VAR_TYPE_NUMBER = 0,
VAR_TYPE_STRING = 1,
VAR_TYPE_FUNC = 2,
VAR_TYPE_LIST = 3,
VAR_TYPE_DICT = 4,
VAR_TYPE_FLOAT = 5,
VAR_TYPE_BOOL = 6,
VAR_TYPE_SPECIAL = 7,
VAR_TYPE_BLOB = 10,
};
/// Structure that holds an internal variable value
typedef struct {
VarType v_type; ///< Variable type.

View File

@ -14,6 +14,7 @@
#include "nvim/ascii.h"
#include "nvim/autocmd.h"
#include "nvim/charset.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/debugger.h"
#include "nvim/eval.h"
#include "nvim/eval/encode.h"

View File

@ -4,6 +4,7 @@
#include <stdbool.h>
#include <stddef.h>
#include "nvim/cmdexpand_defs.h"
#include "nvim/eval.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h"

View File

@ -27,6 +27,7 @@
#include "nvim/change.h"
#include "nvim/channel.h"
#include "nvim/charset.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/cmdhist.h"
#include "nvim/cursor.h"
#include "nvim/decoration.h"

View File

@ -5,6 +5,7 @@
#include <stdint.h>
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_eval_defs.h"
#include "nvim/normal.h"
#include "nvim/pos.h"
#include "nvim/regexp_defs.h"
@ -69,20 +70,20 @@
#define EX_FILE1 (EX_FILES | EX_NOSPC) // 1 file, defaults to current file
#define EX_WORD1 (EX_EXTRA | EX_NOSPC) // one extra word allowed
// values for cmd_addr_type
/// values for cmd_addr_type
typedef enum {
ADDR_LINES, // buffer line numbers
ADDR_WINDOWS, // window number
ADDR_ARGUMENTS, // argument number
ADDR_LOADED_BUFFERS, // buffer number of loaded buffer
ADDR_BUFFERS, // buffer number
ADDR_TABS, // tab page number
ADDR_TABS_RELATIVE, // Tab page that only relative
ADDR_QUICKFIX_VALID, // quickfix list valid entry number
ADDR_QUICKFIX, // quickfix list entry number
ADDR_UNSIGNED, // positive count or zero, defaults to 1
ADDR_OTHER, // something else, use line number for '$', '%', etc.
ADDR_NONE, // no range used
ADDR_LINES, ///< buffer line numbers
ADDR_WINDOWS, ///< window number
ADDR_ARGUMENTS, ///< argument number
ADDR_LOADED_BUFFERS, ///< buffer number of loaded buffer
ADDR_BUFFERS, ///< buffer number
ADDR_TABS, ///< tab page number
ADDR_TABS_RELATIVE, ///< Tab page that only relative
ADDR_QUICKFIX_VALID, ///< quickfix list valid entry number
ADDR_QUICKFIX, ///< quickfix list entry number
ADDR_UNSIGNED, ///< positive count or zero, defaults to 1
ADDR_OTHER, ///< something else, use line number for '$', '%', etc.
ADDR_NONE, ///< no range used
} cmd_addr_T;
typedef struct exarg exarg_T;
@ -128,54 +129,13 @@ typedef char *(*LineGetter)(int, void *, int, bool);
/// Structure for command definition.
typedef struct cmdname {
char *cmd_name; ///< Name of the command.
ex_func_T cmd_func; ///< Function with implementation of this command.
ex_preview_func_T cmd_preview_func; ///< Preview callback function of this command.
uint32_t cmd_argt; ///< Relevant flags from the declared above.
cmd_addr_T cmd_addr_type; ///< Flag for address type.
char *cmd_name; ///< Name of the command.
ex_func_T cmd_func; ///< Function with implementation of this command.
ex_preview_func_T cmd_preview_func; ///< Preview callback function of this command.
uint32_t cmd_argt; ///< Relevant flags from the declared above.
cmd_addr_T cmd_addr_type; ///< Flag for address type.
} CommandDefinition;
// A list used for saving values of "emsg_silent". Used by ex_try() to save the
// value of "emsg_silent" if it was non-zero. When this is done, the CSF_SILENT
// flag below is set.
typedef struct eslist_elem eslist_T;
struct eslist_elem {
int saved_emsg_silent; // saved value of "emsg_silent"
eslist_T *next; // next element on the list
};
// For conditional commands a stack is kept of nested conditionals.
// When cs_idx < 0, there is no conditional command.
enum {
CSTACK_LEN = 50,
};
typedef struct {
int cs_flags[CSTACK_LEN]; // CSF_ flags
char cs_pending[CSTACK_LEN]; // CSTP_: what's pending in ":finally"
union {
void *csp_rv[CSTACK_LEN]; // return typeval for pending return
void *csp_ex[CSTACK_LEN]; // exception for pending throw
} cs_pend;
void *cs_forinfo[CSTACK_LEN]; // info used by ":for"
int cs_line[CSTACK_LEN]; // line nr of ":while"/":for" line
int cs_idx; // current entry, or -1 if none
int cs_looplevel; // nr of nested ":while"s and ":for"s
int cs_trylevel; // nr of nested ":try"s
eslist_T *cs_emsg_silent_list; // saved values of "emsg_silent"
int cs_lflags; // loop flags: CSL_ flags
} cstack_T;
#define cs_rettv cs_pend.csp_rv
#define cs_exception cs_pend.csp_ex
// Flags for the cs_lflags item in cstack_T.
enum {
CSL_HAD_LOOP = 1, // just found ":while" or ":for"
CSL_HAD_ENDLOOP = 2, // just found ":endwhile" or ":endfor"
CSL_HAD_CONT = 4, // just found ":continue"
CSL_HAD_FINA = 8, // just found ":finally"
};
/// Arguments used for Ex commands.
struct exarg {
char *arg; ///< argument of the command
@ -222,41 +182,6 @@ struct exarg {
#define EXFLAG_NR 0x02 // '#': number
#define EXFLAG_PRINT 0x04 // 'p': print
typedef enum {
XP_PREFIX_NONE, ///< prefix not used
XP_PREFIX_NO, ///< "no" prefix for bool option
XP_PREFIX_INV, ///< "inv" prefix for bool option
} xp_prefix_T;
// used for completion on the command line
struct expand {
char *xp_pattern; // start of item to expand
int xp_context; // type of expansion
size_t xp_pattern_len; // bytes in xp_pattern before cursor
xp_prefix_T xp_prefix;
char *xp_arg; // completion function
LuaRef xp_luaref; // Ref to Lua completion function
sctx_T xp_script_ctx; // SCTX for completion function
int xp_backslash; // one of the XP_BS_ values
#ifndef BACKSLASH_IN_FILENAME
int xp_shell; // true for a shell command, more
// characters need to be escaped
#endif
int xp_numfiles; // number of files found by file name completion
int xp_col; // cursor position in line
int xp_selected; // selected index in completion
char *xp_orig; // originally expanded string
char **xp_files; // list of files
char *xp_line; // text being completed
#define EXPAND_BUF_LEN 256
char xp_buf[EXPAND_BUF_LEN]; // buffer for returned match
};
// values for xp_backslash
#define XP_BS_NONE 0 // nothing special for backslashes
#define XP_BS_ONE 1 // uses one backslash before a space
#define XP_BS_THREE 2 // uses three backslashes before a space
enum {
CMOD_SANDBOX = 0x0001, ///< ":sandbox"
CMOD_SILENT = 0x0002, ///< ":silent"

View File

@ -22,6 +22,7 @@
#include "nvim/change.h"
#include "nvim/charset.h"
#include "nvim/cmdexpand.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/cursor.h"
#include "nvim/debugger.h"
#include "nvim/digraph.h"

View File

@ -4,6 +4,7 @@
#include <stdbool.h>
#include "nvim/buffer_defs.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/getchar_defs.h"
#include "nvim/globals.h"

View File

@ -5,6 +5,37 @@
#include "nvim/pos.h"
/// A list used for saving values of "emsg_silent". Used by ex_try() to save the
/// value of "emsg_silent" if it was non-zero. When this is done, the CSF_SILENT
/// flag below is set.
typedef struct eslist_elem eslist_T;
struct eslist_elem {
int saved_emsg_silent; ///< saved value of "emsg_silent"
eslist_T *next; ///< next element on the list
};
/// For conditional commands a stack is kept of nested conditionals.
/// When cs_idx < 0, there is no conditional command.
enum { CSTACK_LEN = 50, };
typedef struct {
int cs_flags[CSTACK_LEN]; ///< CSF_ flags
char cs_pending[CSTACK_LEN]; ///< CSTP_: what's pending in ":finally"
union {
void *csp_rv[CSTACK_LEN]; ///< return typeval for pending return
void *csp_ex[CSTACK_LEN]; ///< exception for pending throw
} cs_pend;
void *cs_forinfo[CSTACK_LEN]; ///< info used by ":for"
int cs_line[CSTACK_LEN]; ///< line nr of ":while"/":for" line
int cs_idx; ///< current entry, or -1 if none
int cs_looplevel; ///< nr of nested ":while"s and ":for"s
int cs_trylevel; ///< nr of nested ":try"s
eslist_T *cs_emsg_silent_list; ///< saved values of "emsg_silent"
int cs_lflags; ///< loop flags: CSL_ flags
} cstack_T;
#define cs_rettv cs_pend.csp_rv
#define cs_exception cs_pend.csp_ex
/// There is no CSF_IF, the lack of CSF_WHILE, CSF_FOR and CSF_TRY means ":if"
/// was used.
enum {
@ -37,6 +68,14 @@ enum {
CSTP_FINISH = 32, ///< ":finish" is pending
};
/// Flags for the cs_lflags item in cstack_T.
enum {
CSL_HAD_LOOP = 1, ///< just found ":while" or ":for"
CSL_HAD_ENDLOOP = 2, ///< just found ":endwhile" or ":endfor"
CSL_HAD_CONT = 4, ///< just found ":continue"
CSL_HAD_FINA = 8, ///< just found ":finally"
};
/// A list of error messages that can be converted to an exception. "throw_msg"
/// is only set in the first element of the list. Usually, it points to the
/// original message stored in that element, but sometimes it points to a later

View File

@ -71,6 +71,7 @@
#include "nvim/search.h"
#include "nvim/state.h"
#include "nvim/strings.h"
#include "nvim/types.h"
#include "nvim/ui.h"
#include "nvim/undo.h"
#include "nvim/usercmd.h"

View File

@ -4,6 +4,7 @@
#include <stdbool.h>
#include "klib/kvec.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/option_defs.h"

View File

@ -28,7 +28,7 @@
#include "nvim/drawscreen.h"
#include "nvim/edit.h"
#include "nvim/eval.h"
#include "nvim/ex_cmds.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/ex_eval.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"

View File

@ -3,7 +3,10 @@
#include "nvim/buffer_defs.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/garray.h"
#include "nvim/globals.h"
#include "nvim/os/fs_defs.h"
#include "nvim/os/os.h"
// Values for readfile() flags

View File

@ -18,13 +18,13 @@
#include "nvim/ascii.h"
#include "nvim/autocmd.h"
#include "nvim/charset.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/cursor_shape.h"
#include "nvim/decoration_provider.h"
#include "nvim/drawscreen.h"
#include "nvim/eval.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/eval/vars.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/ex_docmd.h"
#include "nvim/garray.h"
#include "nvim/gettext.h"

View File

@ -3,6 +3,7 @@
#include "nvim/api/keysets.h"
#include "nvim/api/private/helpers.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/highlight_defs.h"
#include "nvim/types.h"

View File

@ -24,7 +24,6 @@
#include "nvim/eval.h"
#include "nvim/eval/typval.h"
#include "nvim/eval/userfunc.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/ex_docmd.h"
#include "nvim/ex_eval.h"
#include "nvim/ex_getln.h"

View File

@ -20,6 +20,7 @@
#include "nvim/api/private/helpers.h"
#include "nvim/ascii.h"
#include "nvim/change.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/cursor.h"
#include "nvim/drawscreen.h"
#include "nvim/eval.h"

View File

@ -8,6 +8,7 @@
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/assert.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/func_attr.h"

View File

@ -21,6 +21,7 @@
#include "nvim/buffer_defs.h"
#include "nvim/charset.h"
#include "nvim/cmdexpand.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/eval.h"
#include "nvim/eval/typval.h"
#include "nvim/eval/typval_defs.h"

View File

@ -7,6 +7,7 @@
#include "nvim/api/keysets.h"
#include "nvim/api/private/defs.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/mapping_defs.h"

View File

@ -43,6 +43,7 @@
#include "nvim/ascii.h"
#include "nvim/buffer_defs.h"
#include "nvim/charset.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/cursor.h"
#include "nvim/drawscreen.h"
#include "nvim/eval/typval.h"

View File

@ -5,6 +5,7 @@
#include <stdint.h>
#include <string.h>
#include "nvim/cmdexpand_defs.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/func_attr.h"
#include "nvim/mbyte_defs.h"

View File

@ -12,6 +12,7 @@
#include "nvim/ascii.h"
#include "nvim/autocmd.h"
#include "nvim/charset.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/cursor.h"
#include "nvim/eval.h"
#include "nvim/eval/typval.h"

View File

@ -3,6 +3,7 @@
#include <stdbool.h>
#include "nvim/cmdexpand_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/menu_defs.h"
#include "nvim/types.h"

View File

@ -40,6 +40,7 @@
#include "nvim/change.h"
#include "nvim/charset.h"
#include "nvim/cmdexpand.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/cursor_shape.h"
#include "nvim/decoration_provider.h"
#include "nvim/diff.h"

View File

@ -4,6 +4,7 @@
#include <stdint.h>
#include "nvim/api/private/helpers.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/option_defs.h"

View File

@ -1,8 +1,11 @@
#ifndef NVIM_OPTION_DEFS_H
#define NVIM_OPTION_DEFS_H
#include <stdbool.h>
#include <stddef.h>
#include "nvim/api/private/defs.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/regexp_defs.h"
#include "nvim/types.h"

View File

@ -12,6 +12,7 @@
#include "nvim/buffer_defs.h"
#include "nvim/charset.h"
#include "nvim/cmdexpand.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/cursor.h"
#include "nvim/cursor_shape.h"
#include "nvim/diff.h"

View File

@ -2,7 +2,7 @@
#define NVIM_OPTIONSTR_H
#include "nvim/buffer_defs.h"
#include "nvim/cmdexpand.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/option_defs.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS

View File

@ -17,7 +17,6 @@
#include "nvim/charset.h"
#include "nvim/cmdexpand.h"
#include "nvim/eval.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/gettext.h"
#include "nvim/globals.h"
#include "nvim/log.h"
@ -29,7 +28,6 @@
#include "nvim/os/os.h"
#include "nvim/path.h"
#include "nvim/strings.h"
#include "nvim/types.h"
#include "nvim/version.h"
#include "nvim/vim.h"

View File

@ -5,6 +5,7 @@
# define Boolean CFBoolean // Avoid conflict with API's Boolean
# define FileInfo CSFileInfo // Avoid conflict with API's Fileinfo
# include <CoreServices/CoreServices.h>
# undef Boolean
# undef FileInfo
#endif
@ -17,6 +18,7 @@
#include "nvim/ascii.h"
#include "nvim/buffer.h"
#include "nvim/charset.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/eval.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/garray.h"
@ -30,7 +32,6 @@
#include "nvim/os/shell.h"
#include "nvim/path.h"
#include "nvim/profile.h"
#include "nvim/types.h"
#include "nvim/vim.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS

View File

@ -1,6 +1,7 @@
#ifndef NVIM_OS_LANG_H
#define NVIM_OS_LANG_H
#include "nvim/cmdexpand_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/types.h"

View File

@ -4,9 +4,12 @@
#include <stdbool.h>
#include <uv.h>
#include "nvim/buffer_defs.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/garray.h"
#include "nvim/os/fs_defs.h"
#include "nvim/os/stdpaths_defs.h"
#include "nvim/vim.h"
#include "nvim/types.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "os/env.h.generated.h"

View File

@ -10,10 +10,10 @@
#include "auto/config.h"
#include "nvim/ascii.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/garray.h"
#include "nvim/memory.h"
#include "nvim/os/os.h"
#include "nvim/types.h"
#include "nvim/vim.h"
#ifdef HAVE_PWD_FUNCS
# include <pwd.h>

View File

@ -11,6 +11,7 @@
#include "nvim/ascii.h"
#include "nvim/charset.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/debugger.h"
#include "nvim/eval.h"
#include "nvim/eval/typval_defs.h"
@ -30,7 +31,6 @@
#include "nvim/profile.h"
#include "nvim/runtime.h"
#include "nvim/types.h"
#include "nvim/vim.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "profile.c.generated.h"

View File

@ -4,6 +4,7 @@
#include <stdint.h>
#include <time.h>
#include "nvim/cmdexpand_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/runtime.h"

View File

@ -20,6 +20,7 @@
#include "nvim/autocmd.h"
#include "nvim/charset.h"
#include "nvim/cmdexpand.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/debugger.h"
#include "nvim/eval.h"
#include "nvim/eval/typval.h"

View File

@ -5,6 +5,7 @@
#include "klib/kvec.h"
#include "nvim/autocmd.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/ex_eval_defs.h"

View File

@ -1564,15 +1564,14 @@ static ShaDaWriteResult shada_pack_entry(msgpack_packer *const packer, ShadaEntr
break;
}
case kSDItemVariable: {
if (entry.data.global_var.value.v_type == VAR_TYPE_BLOB) {
if (entry.data.global_var.value.v_type == VAR_BLOB) {
// Strings and Blobs both pack as msgpack BINs; differentiate them by
// storing an additional VAR_TYPE_BLOB element alongside Blobs
list_T *const list = tv_list_alloc(1);
tv_list_append_number(list, VAR_TYPE_BLOB);
entry.data.global_var.additional_elements = list;
}
const size_t arr_size = 2 + (size_t)(
tv_list_len(entry.data.global_var.additional_elements));
const size_t arr_size = 2 + (size_t)(tv_list_len(entry.data.global_var.additional_elements));
msgpack_pack_array(spacker, arr_size);
const String varname = cstr_as_string(entry.data.global_var.name);
PACK_BIN(varname);

View File

@ -16,6 +16,7 @@
#include "nvim/buffer.h"
#include "nvim/buffer_defs.h"
#include "nvim/charset.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/cursor.h"
#include "nvim/drawscreen.h"
#include "nvim/edit.h"

View File

@ -4,6 +4,7 @@
#include <stdbool.h>
#include "nvim/buffer_defs.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/sign_defs.h"

View File

@ -15,6 +15,7 @@
#include "nvim/buffer.h"
#include "nvim/buffer_defs.h"
#include "nvim/charset.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/drawscreen.h"
#include "nvim/eval.h"
#include "nvim/eval/typval_defs.h"

View File

@ -4,6 +4,7 @@
#include <stdbool.h>
#include "nvim/buffer_defs.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/globals.h"
#include "nvim/macros.h"

View File

@ -56,7 +56,6 @@
#include "nvim/search.h"
#include "nvim/strings.h"
#include "nvim/tag.h"
#include "nvim/types.h"
#include "nvim/ui.h"
#include "nvim/vim.h"
#include "nvim/window.h"

View File

@ -31,8 +31,6 @@ typedef union {
typedef handle_T NS;
typedef struct expand expand_T;
typedef uint64_t proftime_T;
typedef enum {

View File

@ -16,6 +16,7 @@
#include "nvim/ascii.h"
#include "nvim/buffer_defs.h"
#include "nvim/charset.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/eval.h"
#include "nvim/ex_docmd.h"
#include "nvim/garray.h"

View File

@ -3,6 +3,7 @@
#include <stdint.h>
#include "nvim/cmdexpand_defs.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/garray.h"

View File

@ -96,85 +96,10 @@ typedef enum {
#define FAIL 0
#define NOTDONE 2 // not OK or FAIL but skipped
// Type values for type().
#define VAR_TYPE_NUMBER 0
#define VAR_TYPE_STRING 1
#define VAR_TYPE_FUNC 2
#define VAR_TYPE_LIST 3
#define VAR_TYPE_DICT 4
#define VAR_TYPE_FLOAT 5
#define VAR_TYPE_BOOL 6
#define VAR_TYPE_SPECIAL 7
#define VAR_TYPE_BLOB 10
// values for xp_context when doing command line completion
enum {
EXPAND_UNSUCCESSFUL = -2,
EXPAND_OK = -1,
EXPAND_NOTHING = 0,
EXPAND_COMMANDS,
EXPAND_FILES,
EXPAND_DIRECTORIES,
EXPAND_SETTINGS,
EXPAND_BOOL_SETTINGS,
EXPAND_TAGS,
EXPAND_OLD_SETTING,
EXPAND_HELP,
EXPAND_BUFFERS,
EXPAND_EVENTS,
EXPAND_MENUS,
EXPAND_SYNTAX,
EXPAND_HIGHLIGHT,
EXPAND_AUGROUP,
EXPAND_USER_VARS,
EXPAND_MAPPINGS,
EXPAND_TAGS_LISTFILES,
EXPAND_FUNCTIONS,
EXPAND_USER_FUNC,
EXPAND_EXPRESSION,
EXPAND_MENUNAMES,
EXPAND_USER_COMMANDS,
EXPAND_USER_CMD_FLAGS,
EXPAND_USER_NARGS,
EXPAND_USER_COMPLETE,
EXPAND_ENV_VARS,
EXPAND_LANGUAGE,
EXPAND_COLORS,
EXPAND_COMPILER,
EXPAND_USER_DEFINED,
EXPAND_USER_LIST,
EXPAND_USER_LUA,
EXPAND_SHELLCMD,
EXPAND_SIGN,
EXPAND_PROFILE,
EXPAND_FILETYPE,
EXPAND_FILES_IN_PATH,
EXPAND_OWNSYNTAX,
EXPAND_LOCALES,
EXPAND_HISTORY,
EXPAND_USER,
EXPAND_SYNTIME,
EXPAND_USER_ADDR_TYPE,
EXPAND_PACKADD,
EXPAND_MESSAGES,
EXPAND_MAPCLEAR,
EXPAND_ARGLIST,
EXPAND_DIFF_BUFFERS,
EXPAND_BREAKPOINT,
EXPAND_SCRIPTNAMES,
EXPAND_RUNTIME,
EXPAND_STRING_SETTING,
EXPAND_SETTING_SUBTRACT,
EXPAND_CHECKHEALTH,
EXPAND_LUA,
};
// Minimal size for block 0 of a swap file.
// NOTE: This depends on size of struct block0! It's not done with a sizeof(),
// because struct block0 is defined in memline.c (Sorry).
// The maximal block size is arbitrary.
#define MIN_SWAP_PAGE_SIZE 1048
#define MAX_SWAP_PAGE_SIZE 50000