diff options
author | Josh Rahm <rahm@google.com> | 2022-07-18 19:37:18 +0000 |
---|---|---|
committer | Josh Rahm <rahm@google.com> | 2022-07-18 19:37:18 +0000 |
commit | 308e1940dcd64aa6c344c403d4f9e0dda58d9c5c (patch) | |
tree | 35fe43e01755e0f312650667004487a44d6b7941 /src/nvim/vim.h | |
parent | 96a00c7c588b2f38a2424aeeb4ea3581d370bf2d (diff) | |
parent | e8c94697bcbe23a5c7b07c292b90a6b70aadfa87 (diff) | |
download | rneovim-308e1940dcd64aa6c344c403d4f9e0dda58d9c5c.tar.gz rneovim-308e1940dcd64aa6c344c403d4f9e0dda58d9c5c.tar.bz2 rneovim-308e1940dcd64aa6c344c403d4f9e0dda58d9c5c.zip |
Merge remote-tracking branch 'upstream/master' into rahm
Diffstat (limited to 'src/nvim/vim.h')
-rw-r--r-- | src/nvim/vim.h | 96 |
1 files changed, 41 insertions, 55 deletions
diff --git a/src/nvim/vim.h b/src/nvim/vim.h index 6e0e9922a6..31ac5a67ff 100644 --- a/src/nvim/vim.h +++ b/src/nvim/vim.h @@ -10,7 +10,6 @@ #define SYS_OPTWIN_FILE "$VIMRUNTIME/optwin.vim" #define RUNTIME_DIRNAME "runtime" - #include "auto/config.h" #define HAVE_PATHDEF @@ -31,51 +30,46 @@ enum { NUMBUFLEN = 65, }; #define ROOT_UID 0 #include "nvim/gettext.h" -#include "nvim/keymap.h" +#include "nvim/keycodes.h" #include "nvim/macros.h" // special attribute addition: Put message in history #define MSG_HIST 0x1000 - -// values for State +// Values for State // -// The lower bits up to 0x20 are used to distinguish normal/visual/op_pending -// and cmdline/insert+replace mode. This is used for mapping. If none of -// these bits are set, no mapping is done. -// The upper bits are used to distinguish between other states. - -#define NORMAL 0x01 // Normal mode, command expected -#define VISUAL 0x02 // Visual mode - use get_real_state() -#define OP_PENDING 0x04 // Normal mode, operator is pending - use - // get_real_state() -#define CMDLINE 0x08 // Editing command line -#define INSERT 0x10 // Insert mode -#define LANGMAP 0x20 // Language mapping, can be combined with - // INSERT and CMDLINE - -#define REPLACE_FLAG 0x40 // Replace mode flag -#define REPLACE (REPLACE_FLAG + INSERT) -#define VREPLACE_FLAG 0x80 // Virtual-replace mode flag -#define VREPLACE (REPLACE_FLAG + VREPLACE_FLAG + INSERT) -#define LREPLACE (REPLACE_FLAG + LANGMAP) - -#define NORMAL_BUSY (0x100 + NORMAL) // Normal mode, busy with a command -#define HITRETURN (0x200 + NORMAL) // waiting for return or command -#define ASKMORE 0x300 // Asking if you want --more-- -#define SETWSIZE 0x400 // window size has changed -#define ABBREV 0x500 // abbreviation instead of mapping -#define EXTERNCMD 0x600 // executing an external command -#define SHOWMATCH (0x700 + INSERT) // show matching paren -#define CONFIRM 0x800 // ":confirm" prompt -#define SELECTMODE 0x1000 // Select mode, only for mappings -#define TERM_FOCUS 0x2000 // Terminal focus mode -#define CMDPREVIEW 0x4000 // Showing 'inccommand' command "live" preview. - -#define MODE_MAX_LENGTH 4 // max mode length returned in mode() - -// all mode bits used for mapping -#define MAP_ALL_MODES (0x3f | SELECTMODE | TERM_FOCUS) +// The lower bits up to 0x80 are used to distinguish normal/visual/op_pending +// /cmdline/insert/replace/terminal mode. This is used for mapping. If none +// of these bits are set, no mapping is done. See the comment above do_map(). +// The upper bits are used to distinguish between other states and variants of +// the base modes. + +#define MODE_NORMAL 0x01 // Normal mode, command expected +#define MODE_VISUAL 0x02 // Visual mode - use get_real_state() +#define MODE_OP_PENDING 0x04 // Normal mode, operator is pending - use + // get_real_state() +#define MODE_CMDLINE 0x08 // Editing the command line +#define MODE_INSERT 0x10 // Insert mode, also for Replace mode +#define MODE_LANGMAP 0x20 // Language mapping, can be combined with + // MODE_INSERT and MODE_CMDLINE +#define MODE_SELECT 0x40 // Select mode, use get_real_state() +#define MODE_TERMINAL 0x80 // Terminal mode + +#define MAP_ALL_MODES 0xff // all mode bits used for mapping + +#define REPLACE_FLAG 0x100 // Replace mode flag +#define MODE_REPLACE (REPLACE_FLAG | MODE_INSERT) +#define VREPLACE_FLAG 0x200 // Virtual-replace mode flag +#define MODE_VREPLACE (REPLACE_FLAG | VREPLACE_FLAG | MODE_INSERT) +#define MODE_LREPLACE (REPLACE_FLAG | MODE_LANGMAP) + +#define MODE_NORMAL_BUSY (0x1000 | MODE_NORMAL) // Normal mode, busy with a command +#define MODE_HITRETURN (0x2000 | MODE_NORMAL) // waiting for return or command +#define MODE_ASKMORE 0x3000 // Asking if you want --more-- +#define MODE_SETWSIZE 0x4000 // window size has changed +#define MODE_EXTERNCMD 0x5000 // executing an external command +#define MODE_SHOWMATCH (0x6000 | MODE_INSERT) // show matching paren +#define MODE_CONFIRM 0x7000 // ":confirm" prompt /// Directions. typedef enum { @@ -105,7 +99,6 @@ typedef enum { #define VAR_TYPE_SPECIAL 7 #define VAR_TYPE_BLOB 10 - // values for xp_context when doing command line completion enum { @@ -166,7 +159,6 @@ enum { 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). @@ -175,7 +167,6 @@ enum { #define MIN_SWAP_PAGE_SIZE 1048 #define MAX_SWAP_PAGE_SIZE 50000 - // Boolean constants #ifndef TRUE @@ -188,7 +179,6 @@ enum { #define STATUS_HEIGHT 1 // height of a status line under a window #define QF_WINHEIGHT 10 // default height for quickfix window - // Buffer sizes #ifndef CMDBUFFSIZE @@ -201,7 +191,6 @@ enum { enum { FOLD_TEXT_LEN = 51, }; //!< buffer size for get_foldtext() - // Maximum length of key sequence to be mapped. // Must be able to hold an Amiga resize report. @@ -217,9 +206,9 @@ enum { FOLD_TEXT_LEN = 51, }; //!< buffer size for get_foldtext() #define STRLEN(s) strlen((char *)(s)) #ifdef HAVE_STRNLEN -# define STRNLEN(s, n) strnlen((char *)(s), (size_t)(n)) +# define STRNLEN(s, n) strnlen((char *)(s), (size_t)(n)) #else -# define STRNLEN(s, n) xstrnlen((char *)(s), (size_t)(n)) +# define STRNLEN(s, n) xstrnlen((char *)(s), (size_t)(n)) #endif #define STRCPY(d, s) strcpy((char *)(d), (char *)(s)) #define STRNCPY(d, s, n) strncpy((char *)(d), (char *)(s), (size_t)(n)) @@ -255,8 +244,6 @@ enum { FOLD_TEXT_LEN = 51, }; //!< buffer size for get_foldtext() #define STRNCAT(d, s, n) strncat((char *)(d), (char *)(s), (size_t)(n)) #define STRLCAT(d, s, n) xstrlcat((char *)(d), (char *)(s), (size_t)(n)) -#define vim_strpbrk(s, cs) (char_u *)strpbrk((char *)(s), (char *)(cs)) - // Character used as separated in autoload function/variable names. #define AUTOLOAD_CHAR '#' @@ -264,7 +251,7 @@ enum { FOLD_TEXT_LEN = 51, }; //!< buffer size for get_foldtext() // Prefer using semsg(), because perror() may send the output to the wrong // destination and mess up the screen. -#define PERROR(msg) (void)semsg("%s: %s", msg, strerror(errno)) +#define PERROR(msg) (void)semsg("%s: %s", (msg), strerror(errno)) #define SHOWCMD_COLS 10 // columns needed by shown command @@ -282,12 +269,11 @@ enum { FOLD_TEXT_LEN = 51, }; //!< buffer size for get_foldtext() /// @param[in] y Second file name to compare. /// /// @return 0 for equal file names, non-zero otherwise. -#define fnamecmp(x, y) path_fnamecmp((const char *)(x), (const char *)(y)) -#define fnamencmp(x, y, n) path_fnamencmp((const char *)(x), \ +#define FNAMECMP(x, y) path_fnamecmp((const char *)(x), (const char *)(y)) +#define FNAMENCMP(x, y, n) path_fnamencmp((const char *)(x), \ (const char *)(y), \ (size_t)(n)) - // Enums need a typecast to be used as array index (for Ultrix). #define HL_ATTR(n) highlight_attr[(int)(n)] @@ -319,7 +305,7 @@ enum { FOLD_TEXT_LEN = 51, }; //!< buffer size for get_foldtext() #endif // Replacement for nchar used by nv_replace(). -#define REPLACE_CR_NCHAR -1 -#define REPLACE_NL_NCHAR -2 +#define REPLACE_CR_NCHAR (-1) +#define REPLACE_NL_NCHAR (-2) #endif // NVIM_VIM_H |