Mercurial > vim
changeset 11995:7df3dd3c0ac1 v8.0.0878
patch 8.0.0878: no completion for :mapclear
commit https://github.com/vim/vim/commit/cae92dc3d5bdd4009910671328cd01394bfbe2cf
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Aug 6 15:22:15 2017 +0200
patch 8.0.0878: no completion for :mapclear
Problem: No completion for :mapclear.
Solution: Add completion (Nobuhiro Takasaki et al. closes https://github.com/vim/vim/issues/1943)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 06 Aug 2017 15:30:04 +0200 |
parents | ed6f0cb37dab |
children | 4adaaa738e57 |
files | runtime/doc/eval.txt runtime/doc/map.txt src/ex_docmd.c src/ex_getln.c src/proto/ex_docmd.pro src/testdir/test_cmdline.vim src/version.c src/vim.h |
diffstat | 8 files changed, 34 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -4368,6 +4368,7 @@ getcompletion({pat}, {type} [, {filtered highlight highlight groups history :history suboptions locale locale names (as output of locale -a) + mapclear buffer argument mapping mapping name menu menus messages |:messages| suboptions
--- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1279,6 +1279,7 @@ completion can be enabled: -complete=highlight highlight groups -complete=history :history suboptions -complete=locale locale names (as output of locale -a) + -complete=mapclear buffer argument -complete=mapping mapping name -complete=menu menus -complete=messages |:messages| suboptions
--- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -4223,6 +4223,19 @@ set_one_cmd_context( case CMD_xunmap: return set_context_in_map_cmd(xp, cmd, 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 = arg; + break; + case CMD_abbreviate: case CMD_noreabbrev: case CMD_cabbrev: case CMD_cnoreabbrev: case CMD_iabbrev: case CMD_inoreabbrev: @@ -5964,6 +5977,7 @@ static struct && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE)) {EXPAND_LOCALES, "locale"}, #endif + {EXPAND_MAPCLEAR, "mapclear"}, {EXPAND_MAPPINGS, "mapping"}, {EXPAND_MENUS, "menu"}, {EXPAND_MESSAGES, "messages"}, @@ -12083,6 +12097,14 @@ get_messages_arg(expand_T *xp UNUSED, in } #endif + char_u * +get_mapclear_arg(expand_T *xp UNUSED, int idx) +{ + if (idx == 0) + return (char_u *)"<buffer>"; + return NULL; +} + #ifdef FEAT_AUTOCMD static int filetype_detect = FALSE; static int filetype_plugin = FALSE;
--- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -4879,6 +4879,7 @@ ExpandFromContext( { {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}, #ifdef FEAT_CMDHIST {EXPAND_HISTORY, get_history_arg, TRUE, TRUE},
--- a/src/proto/ex_docmd.pro +++ b/src/proto/ex_docmd.pro @@ -62,4 +62,5 @@ int put_line(FILE *fd, char *s); void dialog_msg(char_u *buff, char *format, char_u *fname); char_u *get_behave_arg(expand_T *xp, int idx); char_u *get_messages_arg(expand_T *xp, int idx); +char_u *get_mapclear_arg(expand_T *xp, int idx); /* vim: set ft=c : */
--- a/src/testdir/test_cmdline.vim +++ b/src/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']