diff options
author | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-08-16 10:24:49 -0400 |
---|---|---|
committer | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-08-16 10:42:13 -0400 |
commit | 6531b175addc33c710b6e4e3501077e1d7213a8c (patch) | |
tree | 303675036347de439a28ca016156309e5ec51f15 /src | |
parent | b5cfac089409faf17a290d4bfe1b669212e2984e (diff) | |
download | rneovim-6531b175addc33c710b6e4e3501077e1d7213a8c.tar.gz rneovim-6531b175addc33c710b6e4e3501077e1d7213a8c.tar.bz2 rneovim-6531b175addc33c710b6e4e3501077e1d7213a8c.zip |
vim-patch:8.0.0878: no completion for :mapclear
Problem: No completion for :mapclear.
Solution: Add completion (Nobuhiro Takasaki et al. closes vim/vim#1943)
https://github.com/vim/vim/commit/cae92dc3d5bdd4009910671328cd01394bfbe2cf
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_docmd.c | 22 | ||||
-rw-r--r-- | src/nvim/ex_getln.c | 1 | ||||
-rw-r--r-- | src/nvim/testdir/test_cmdline.vim | 5 | ||||
-rw-r--r-- | src/nvim/vim.h | 1 |
4 files changed, 29 insertions, 0 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index c31242f2ac..df9f5774bc 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -3350,6 +3350,19 @@ const char * set_one_cmd_context( case CMD_xunmap: return (const char *)set_context_in_map_cmd( xp, (char_u *)cmd, (char_u *)arg, forceit, false, true, ea.cmdidx); + case CMD_mapclear: + case CMD_nmapclear: + case CMD_vmapclear: + case CMD_omapclear: + case CMD_imapclear: + case CMD_cmapclear: + case CMD_lmapclear: + case CMD_smapclear: + case CMD_xmapclear: + xp->xp_context = EXPAND_MAPCLEAR; + xp->xp_pattern = (char_u *)arg; + break; + case CMD_abbreviate: case CMD_noreabbrev: case CMD_cabbrev: case CMD_cnoreabbrev: case CMD_iabbrev: case CMD_inoreabbrev: @@ -4870,6 +4883,7 @@ static const char *command_complete[] = #ifdef HAVE_WORKING_LIBINTL [EXPAND_LOCALES] = "locale", #endif + [EXPAND_MAPCLEAR] = "mapclear", [EXPAND_MAPPINGS] = "mapping", [EXPAND_MENUS] = "menu", [EXPAND_MESSAGES] = "messages", @@ -9655,6 +9669,14 @@ char_u *get_messages_arg(expand_T *xp FUNC_ATTR_UNUSED, int idx) return NULL; } +char_u *get_mapclear_arg(expand_T *xp FUNC_ATTR_UNUSED, int idx) +{ + if (idx == 0) { + return (char_u *)"<buffer>"; + } + return NULL; +} + static TriState filetype_detect = kNone; static TriState filetype_plugin = kNone; static TriState filetype_indent = kNone; diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 1810056a4a..e8a85e7cf6 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -4756,6 +4756,7 @@ ExpandFromContext ( } tab[] = { { EXPAND_COMMANDS, get_command_name, false, true }, { EXPAND_BEHAVE, get_behave_arg, true, true }, + { EXPAND_MAPCLEAR, get_mapclear_arg, true, true }, { EXPAND_MESSAGES, get_messages_arg, true, true }, { EXPAND_HISTORY, get_history_arg, true, true }, { EXPAND_USER_COMMANDS, get_user_commands, false, true }, diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index 5a43838218..a93beac4ad 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -222,6 +222,11 @@ func Test_getcompletion() let l = getcompletion('not', 'messages') call assert_equal([], l) + let l = getcompletion('', 'mapclear') + call assert_true(index(l, '<buffer>') >= 0) + let l = getcompletion('not', 'mapclear') + call assert_equal([], l) + if has('cscope') let l = getcompletion('', 'cscope') let cmds = ['add', 'find', 'help', 'kill', 'reset', 'show'] diff --git a/src/nvim/vim.h b/src/nvim/vim.h index bddf092789..93cc58524e 100644 --- a/src/nvim/vim.h +++ b/src/nvim/vim.h @@ -155,6 +155,7 @@ enum { EXPAND_USER_ADDR_TYPE, EXPAND_PACKADD, EXPAND_MESSAGES, + EXPAND_MAPCLEAR, EXPAND_CHECKHEALTH, }; |