neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

cmdexpand_defs.h (3526B)


      1 #pragma once
      2 
      3 #include <stdbool.h>
      4 #include <stddef.h>
      5 
      6 #include "nvim/eval/typval_defs.h"
      7 #include "nvim/pos_defs.h"
      8 #include "nvim/vim_defs.h"
      9 
     10 typedef enum {
     11  XP_PREFIX_NONE,  ///< prefix not used
     12  XP_PREFIX_NO,    ///< "no" prefix for bool option
     13  XP_PREFIX_INV,   ///< "inv" prefix for bool option
     14 } xp_prefix_T;
     15 
     16 enum { EXPAND_BUF_LEN = 256, };
     17 
     18 /// used for completion on the command line
     19 typedef struct {
     20  char *xp_pattern;             ///< start of item to expand, guaranteed
     21                                ///< to be part of xp_line
     22  int xp_context;               ///< type of expansion
     23  size_t xp_pattern_len;        ///< bytes in xp_pattern before cursor
     24  xp_prefix_T xp_prefix;
     25  char *xp_arg;                 ///< completion function
     26  LuaRef xp_luaref;             ///< Ref to Lua completion function
     27  sctx_T xp_script_ctx;         ///< SCTX for completion function
     28  int xp_backslash;             ///< one of the XP_BS_ values
     29 #ifndef BACKSLASH_IN_FILENAME
     30  bool xp_shell;                ///< true for a shell command, more
     31                                ///< characters need to be escaped
     32 #endif
     33  int xp_numfiles;              ///< number of files found by file name completion
     34  int xp_col;                   ///< cursor position in line
     35  int xp_selected;              ///< selected index in completion
     36  char *xp_orig;                ///< originally expanded string
     37  char **xp_files;              ///< list of files
     38  char *xp_line;                ///< text being completed
     39  char xp_buf[EXPAND_BUF_LEN];  ///< buffer for returned match
     40  Direction xp_search_dir;      ///< Direction of search
     41  pos_T xp_pre_incsearch_pos;   ///< Cursor position before incsearch
     42 } expand_T;
     43 
     44 /// values for xp_backslash
     45 enum {
     46  XP_BS_NONE  = 0,    ///< nothing special for backslashes
     47  XP_BS_ONE   = 0x1,  ///< uses one backslash before a space
     48  XP_BS_THREE = 0x2,  ///< uses three backslashes before a space
     49  XP_BS_COMMA = 0x4,  ///< commas need to be escaped with a backslash
     50 };
     51 
     52 /// values for xp_context when doing command line completion
     53 enum {
     54  EXPAND_UNSUCCESSFUL = -2,
     55  EXPAND_OK = -1,
     56  EXPAND_NOTHING = 0,
     57  EXPAND_COMMANDS,
     58  EXPAND_FILES,
     59  EXPAND_DIRECTORIES,
     60  EXPAND_SETTINGS,
     61  EXPAND_BOOL_SETTINGS,
     62  EXPAND_TAGS,
     63  EXPAND_OLD_SETTING,
     64  EXPAND_HELP,
     65  EXPAND_BUFFERS,
     66  EXPAND_EVENTS,
     67  EXPAND_MENUS,
     68  EXPAND_SYNTAX,
     69  EXPAND_HIGHLIGHT,
     70  EXPAND_AUGROUP,
     71  EXPAND_USER_VARS,
     72  EXPAND_MAPPINGS,
     73  EXPAND_TAGS_LISTFILES,
     74  EXPAND_FUNCTIONS,
     75  EXPAND_USER_FUNC,
     76  EXPAND_EXPRESSION,
     77  EXPAND_MENUNAMES,
     78  EXPAND_USER_COMMANDS,
     79  EXPAND_USER_CMD_FLAGS,
     80  EXPAND_USER_NARGS,
     81  EXPAND_USER_COMPLETE,
     82  EXPAND_ENV_VARS,
     83  EXPAND_LANGUAGE,
     84  EXPAND_COLORS,
     85  EXPAND_COMPILER,
     86  EXPAND_USER_DEFINED,
     87  EXPAND_USER_LIST,
     88  EXPAND_USER_LUA,
     89  EXPAND_SHELLCMD,
     90  EXPAND_SIGN,
     91  EXPAND_PROFILE,
     92  EXPAND_FILETYPE,
     93  EXPAND_FILES_IN_PATH,
     94  EXPAND_OWNSYNTAX,
     95  EXPAND_LOCALES,
     96  EXPAND_HISTORY,
     97  EXPAND_USER,
     98  EXPAND_SYNTIME,
     99  EXPAND_USER_ADDR_TYPE,
    100  EXPAND_PACKADD,
    101  EXPAND_MESSAGES,
    102  EXPAND_MAPCLEAR,
    103  EXPAND_ARGLIST,
    104  EXPAND_DIFF_BUFFERS,
    105  // EXPAND_DISASSEMBLE,
    106  EXPAND_BREAKPOINT,
    107  EXPAND_SCRIPTNAMES,
    108  EXPAND_RUNTIME,
    109  EXPAND_STRING_SETTING,
    110  EXPAND_SETTING_SUBTRACT,
    111  EXPAND_ARGOPT,
    112  EXPAND_KEYMAP,
    113  EXPAND_DIRS_IN_CDPATH,
    114  EXPAND_SHELLCMDLINE,
    115  EXPAND_FINDFUNC,
    116  EXPAND_FILETYPECMD,
    117  EXPAND_PATTERN_IN_BUF,
    118  EXPAND_RETAB,
    119  EXPAND_CHECKHEALTH,
    120  EXPAND_LUA,
    121  EXPAND_LSP,
    122 };
    123 
    124 /// Type used by ExpandGeneric()
    125 typedef char *(*CompleteListItemGetter)(expand_T *, int);