diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 22:40:31 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 22:40:31 +0000 |
commit | 339e2d15cc26fe86988ea06468d912a46c8d6f29 (patch) | |
tree | a6167fc8fcfc6ae2dc102f57b2473858eac34063 /src/nvim/state_defs.h | |
parent | 067dc73729267c0262438a6fdd66e586f8496946 (diff) | |
parent | 4a8bf24ac690004aedf5540fa440e788459e5e34 (diff) | |
download | rneovim-339e2d15cc26fe86988ea06468d912a46c8d6f29.tar.gz rneovim-339e2d15cc26fe86988ea06468d912a46c8d6f29.tar.bz2 rneovim-339e2d15cc26fe86988ea06468d912a46c8d6f29.zip |
Merge remote-tracking branch 'upstream/master' into fix_repeatcmdline
Diffstat (limited to 'src/nvim/state_defs.h')
-rw-r--r-- | src/nvim/state_defs.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/nvim/state_defs.h b/src/nvim/state_defs.h new file mode 100644 index 0000000000..0b32412f5a --- /dev/null +++ b/src/nvim/state_defs.h @@ -0,0 +1,45 @@ +#pragma once + +typedef struct vim_state VimState; + +typedef int (*state_check_callback)(VimState *state); +typedef int (*state_execute_callback)(VimState *state, int key); + +struct vim_state { + state_check_callback check; + state_execute_callback execute; +}; + +/// Values for State +/// +/// 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. +enum { + MODE_NORMAL = 0x01, ///< Normal mode, command expected + MODE_VISUAL = 0x02, ///< Visual mode - use get_real_state() + MODE_OP_PENDING = 0x04, ///< Normal mode, operator is pending - use get_real_state() + MODE_CMDLINE = 0x08, ///< Editing the command line + MODE_INSERT = 0x10, ///< Insert mode, also for Replace mode + MODE_LANGMAP = 0x20, ///< Language mapping, can be combined with MODE_INSERT and MODE_CMDLINE + MODE_SELECT = 0x40, ///< Select mode, use get_real_state() + MODE_TERMINAL = 0x80, ///< Terminal mode + + MAP_ALL_MODES = 0xff, ///< all mode bits used for mapping + + REPLACE_FLAG = 0x100, ///< Replace mode flag + MODE_REPLACE = REPLACE_FLAG | MODE_INSERT, + VREPLACE_FLAG = 0x200, ///< Virtual-replace mode flag + MODE_VREPLACE = REPLACE_FLAG | VREPLACE_FLAG | MODE_INSERT, + MODE_LREPLACE = REPLACE_FLAG | MODE_LANGMAP, + + MODE_NORMAL_BUSY = 0x1000 | MODE_NORMAL, ///< Normal mode, busy with a command + MODE_HITRETURN = 0x2000 | MODE_NORMAL, ///< waiting for return or command + MODE_ASKMORE = 0x3000, ///< Asking if you want --more-- + MODE_SETWSIZE = 0x4000, ///< window size has changed + MODE_EXTERNCMD = 0x5000, ///< executing an external command + MODE_SHOWMATCH = 0x6000 | MODE_INSERT, ///< show matching paren + MODE_CONFIRM = 0x7000, ///< ":confirm" prompt +}; |