diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-08-26 11:13:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-26 11:13:20 +0800 |
commit | 1635c9e75e21e07c4331cf983e14a11c7e09b119 (patch) | |
tree | 2acd3792ff17e17b9caa5c7b90e63710ffcba103 /src/nvim/mapping.c | |
parent | b1cfb299df2ef412339f594173ed23c75c090c8a (diff) | |
download | rneovim-1635c9e75e21e07c4331cf983e14a11c7e09b119.tar.gz rneovim-1635c9e75e21e07c4331cf983e14a11c7e09b119.tar.bz2 rneovim-1635c9e75e21e07c4331cf983e14a11c7e09b119.zip |
refactor: move some structs out of buffer_defs.h (#24878)
Diffstat (limited to 'src/nvim/mapping.c')
-rw-r--r-- | src/nvim/mapping.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/nvim/mapping.c b/src/nvim/mapping.c index f2732184db..ab528f8865 100644 --- a/src/nvim/mapping.c +++ b/src/nvim/mapping.c @@ -61,6 +61,48 @@ static mapblock_T *(maphash[MAX_MAPHASH]) = { 0 }; (MODE_NORMAL | MODE_VISUAL | MODE_SELECT | \ MODE_OP_PENDING | MODE_TERMINAL)) ? (c1) : ((c1) ^ 0x80)) +/// All possible |:map-arguments| usable in a |:map| command. +/// +/// The <special> argument has no effect on mappings and is excluded from this +/// struct declaration. |:noremap| is included, since it behaves like a map +/// argument when used in a mapping. +/// +/// @see mapblock_T +struct map_arguments { + bool buffer; + bool expr; + bool noremap; + bool nowait; + bool script; + bool silent; + bool unique; + bool replace_keycodes; + + /// The {lhs} of the mapping. + /// + /// vim limits this to MAXMAPLEN characters, allowing us to use a static + /// buffer. Setting lhs_len to a value larger than MAXMAPLEN can signal + /// that {lhs} was too long and truncated. + char lhs[MAXMAPLEN + 1]; + size_t lhs_len; + + /// Unsimplifed {lhs} of the mapping. If no simplification has been done then alt_lhs_len is 0. + char alt_lhs[MAXMAPLEN + 1]; + size_t alt_lhs_len; + + char *rhs; /// The {rhs} of the mapping. + size_t rhs_len; + LuaRef rhs_lua; /// lua function as {rhs} + bool rhs_is_noop; /// True when the {rhs} should be <Nop>. + + char *orig_rhs; /// The original text of the {rhs}. + size_t orig_rhs_len; + char *desc; /// map description +}; +typedef struct map_arguments MapArguments; +#define MAP_ARGUMENTS_INIT { false, false, false, false, false, false, false, false, \ + { 0 }, 0, { 0 }, 0, NULL, 0, LUA_NOREF, false, NULL, 0, NULL } + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "mapping.c.generated.h" #endif |