To: vim_dev@googlegroups.com Subject: Patch 8.0.1649 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1649 Problem: No completion for argument list commands. Solution: Add arglist completion. (Yegappan Lakshmanan, closes #2706) Files: runtime/doc/eval.txt, runtime/doc/map.txt, src/ex_cmds2.c, src/ex_docmd.c, src/ex_getln.c, src/proto/ex_cmds2.pro, src/testdir/test_cmdline.vim, src/vim.h *** ../vim-8.0.1648/runtime/doc/eval.txt 2018-03-22 23:03:56.114361979 +0100 --- runtime/doc/eval.txt 2018-03-29 14:58:37.439802331 +0200 *************** *** 4454,4459 **** --- 4469,4475 ---- specifies what for. The following completion types are supported: + arglist file names in argument list augroup autocmd groups buffer buffer names behave :behave suboptions *** ../vim-8.0.1648/runtime/doc/map.txt 2017-09-17 20:32:15.298326050 +0200 --- runtime/doc/map.txt 2018-03-29 14:58:37.439802331 +0200 *************** *** 1271,1276 **** --- 1272,1278 ---- However, by specifying one or the other of the following attributes, argument completion can be enabled: + -complete=arglist file names in argument list -complete=augroup autocmd groups -complete=buffer buffer names -complete=behave :behave suboptions *** ../vim-8.0.1648/src/ex_cmds2.c 2018-03-10 20:27:32.067757685 +0100 --- src/ex_cmds2.c 2018-03-29 15:51:08.887804555 +0200 *************** *** 3314,3319 **** --- 3314,3334 ---- #endif /* FEAT_LISTCMDS */ + #if defined(FEAT_CMDL_COMPL) || defined(PROTO) + /* + * Function given to ExpandGeneric() to obtain the possible arguments of the + * argedit and argdelete commands. + */ + char_u * + get_arglist_name(expand_T *xp UNUSED, int idx) + { + if (idx >= ARGCOUNT) + return NULL; + + return alist_name(&ARGLIST[idx]); + } + #endif + #ifdef FEAT_EVAL /* * ":compiler[!] {name}" *** ../vim-8.0.1648/src/ex_docmd.c 2018-03-11 14:43:53.080536844 +0100 --- src/ex_docmd.c 2018-03-29 15:52:06.531520954 +0200 *************** *** 4293,4298 **** --- 4293,4305 ---- break; #endif + case CMD_argdelete: + while ((xp->xp_pattern = vim_strchr(arg, ' ')) != NULL) + arg = xp->xp_pattern + 1; + xp->xp_context = EXPAND_ARGLIST; + xp->xp_pattern = arg; + break; + #endif /* FEAT_CMDL_COMPL */ default: *************** *** 5879,5884 **** --- 5886,5892 ---- char *name; } command_complete[] = { + {EXPAND_ARGLIST, "arglist"}, {EXPAND_AUGROUP, "augroup"}, {EXPAND_BEHAVE, "behave"}, {EXPAND_BUFFERS, "buffer"}, *** ../vim-8.0.1648/src/ex_getln.c 2018-03-04 18:07:04.252592449 +0100 --- src/ex_getln.c 2018-03-29 15:31:23.273186817 +0200 *************** *** 4989,4994 **** --- 4989,4995 ---- #endif {EXPAND_ENV_VARS, get_env_name, TRUE, TRUE}, {EXPAND_USER, get_users, TRUE, FALSE}, + {EXPAND_ARGLIST, get_arglist_name, TRUE, FALSE}, }; int i; *** ../vim-8.0.1648/src/proto/ex_cmds2.pro 2018-02-11 19:06:20.269418910 +0100 --- src/proto/ex_cmds2.pro 2018-03-29 14:58:37.443802305 +0200 *************** *** 67,72 **** --- 67,73 ---- void ex_argadd(exarg_T *eap); void ex_argdelete(exarg_T *eap); void ex_listdo(exarg_T *eap); + char_u *get_arglist_name(expand_T *xp, int idx); void ex_compiler(exarg_T *eap); void ex_runtime(exarg_T *eap); int do_in_path(char_u *path, char_u *name, int flags, void (*callback)(char_u *fname, void *ck), void *cookie); *** ../vim-8.0.1648/src/testdir/test_cmdline.vim 2017-10-28 17:53:00.387998480 +0200 --- src/testdir/test_cmdline.vim 2018-03-29 14:58:37.443802305 +0200 *************** *** 137,142 **** --- 137,147 ---- let l = getcompletion('v:notexists', 'var') call assert_equal([], l) + args a.c b.c + let l = getcompletion('', 'arglist') + call assert_equal(['a.c', 'b.c'], l) + %argdelete + let l = getcompletion('', 'augroup') call assert_true(index(l, 'END') >= 0) let l = getcompletion('blahblah', 'augroup') *** ../vim-8.0.1648/src/vim.h 2018-03-16 20:46:52.674189967 +0100 --- src/vim.h 2018-03-29 14:58:37.443802305 +0200 *************** *** 781,786 **** --- 781,787 ---- #define EXPAND_PACKADD 45 #define EXPAND_MESSAGES 46 #define EXPAND_MAPCLEAR 47 + #define EXPAND_ARGLIST 48 /* Values for exmode_active (0 is no exmode) */ #define EXMODE_NORMAL 1 *** ../vim-8.0.1648/src/version.c 2018-03-27 21:11:56.446547165 +0200 --- src/version.c 2018-03-29 15:31:35.537140590 +0200 *************** *** 768,769 **** --- 764,767 ---- { /* Add new patch number below this line */ + /**/ + 1649, /**/ -- From "know your smileys": y:-) Bad toupee /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///