diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/option.c | 13 | ||||
-rw-r--r-- | src/nvim/options.lua | 4 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index 0c8230d7c9..389d5ee218 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -2677,6 +2677,19 @@ static const char *did_set_updatecount(optset_T *args) return NULL; } +/// Process the new 'wildchar' / 'wildcharm' option value. +static const char *did_set_wildchar(optset_T *args) +{ + OptInt c = *(OptInt *)args->os_varp; + + // Don't allow key values that wouldn't work as wildchar. + if (c == Ctrl_C || c == '\n' || c == '\r' || c == K_KENTER) { + return e_invarg; + } + + return NULL; +} + /// Process the new 'winblend' option value. static const char *did_set_winblend(optset_T *args) { diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 8d12d860d8..d416b0070f 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -9473,6 +9473,7 @@ return { }, { abbreviation = 'wc', + cb = 'did_set_wildchar', defaults = { if_true = imacros('TAB'), doc = '<Tab>', @@ -9484,6 +9485,8 @@ return { The character is not recognized when used inside a macro. See 'wildcharm' for that. 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: > :set wc=<Tab> < @@ -9496,6 +9499,7 @@ return { }, { abbreviation = 'wcm', + cb = 'did_set_wildchar', defaults = { if_true = 0 }, desc = [=[ 'wildcharm' works exactly like 'wildchar', except that it is |