diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/option.c | 16 | ||||
-rw-r--r-- | src/nvim/options.lua | 7 |
2 files changed, 17 insertions, 6 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index aa6f330dfc..f54da54a4b 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -1525,7 +1525,9 @@ static int find_key_len(const char *arg_arg, size_t len, bool has_lt) // Don't use get_special_key_code() for t_xx, we don't want it to call // add_termcap_entry(). if (len >= 4 && arg[0] == 't' && arg[1] == '_') { - key = TERMCAP2KEY((uint8_t)arg[2], (uint8_t)arg[3]); + if (!has_lt || arg[4] == '>') { + key = TERMCAP2KEY((uint8_t)arg[2], (uint8_t)arg[3]); + } } else if (has_lt) { arg--; // put arg at the '<' int modifiers = 0; @@ -1539,14 +1541,18 @@ static int find_key_len(const char *arg_arg, size_t len, bool has_lt) } /// Convert a key name or string into a key value. -/// Used for 'wildchar' and 'cedit' options. +/// Used for 'cedit', 'wildchar' and 'wildcharm' options. int string_to_key(char *arg) { - if (*arg == '<') { + if (*arg == '<' && arg[1]) { return find_key_len(arg + 1, strlen(arg), true); } - if (*arg == '^') { - return CTRL_CHR((uint8_t)arg[1]); + if (*arg == '^' && arg[1]) { + int key = CTRL_CHR((uint8_t)arg[1]); + if (key == 0) { // ^@ is <Nul> + key = K_ZERO; + } + return key; } return (uint8_t)(*arg); } diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 0d3f7154af..db04de1e3a 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -9620,7 +9620,12 @@ return { Some keys will not work, such as CTRL-C, <CR> and Enter. <Esc> can be used, but hitting it twice in a row will still exit command-line as a failsafe measure. - Although 'wc' is a number option, you can set it to a special key: >vim + Although 'wc' is a number option, it can be specified as a number, a + single character, a |key-notation| (e.g. <Up>, <C-F>) or a letter + preceded with a caret (e.g. `^F` is CTRL-F): >vim + :set wc=27 + :set wc=X + :set wc=^I set wc=<Tab> < ]=], |