1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include "nvim/eval/typval_defs.h"
#include "nvim/types_defs.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, guaranteed
///< to be part of xp_line
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 = 0x1, ///< uses one backslash before a space
XP_BS_THREE = 0x2, ///< uses three backslashes before a space
XP_BS_COMMA = 0x4, ///< commas need to be escaped with a backslash
};
/// 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_ARGOPT,
EXPAND_CHECKHEALTH,
EXPAND_LUA,
};
/// Type used by ExpandGeneric()
typedef char *(*CompleteListItemGetter)(expand_T *, int);
|