-complete=customlist,XXX doesn't work for command A123

41 views
Skip to first unread message

mattn

unread,
Oct 10, 2015, 10:27:02 AM10/10/15
to vim_dev
Hi list.

When number is contained in command name like below, -customlist,XXX doesn't work.

function! s:complete(a,b,c)
return ["foo", "bar", "baz"]
endfunction


command! -nargs=1 -complete=customlist,<SID>complete A123 echo <q-args>

Below is a patch to tix this problem.

- mattn

diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index c3a01df..7509fe0 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3515,8 +3515,11 @@ set_one_cmd_context(xp, buff)
else
{
p = cmd;
- while (ASCII_ISALPHA(*p) || *p == '*') /* Allow * wild card */
+ if (ASCII_ISALPHA(*p) || *p == '*') { /* Allow * wild card */
++p;
+ while (ASCII_ISALNUM(*p) || *p == '*')
+ ++p;
+ }
/* check for non-alpha command */
if (p == cmd && vim_strchr((char_u *)"@*!=><&~#", *p) != NULL)
++p;

Bram Moolenaar

unread,
Oct 10, 2015, 5:28:05 PM10/10/15
to mattn, vim_dev

Yasuhiro Matsumoto wrote:

> When number is contained in command name like below, -customlist,XXX
> doesn't work.
>
> function! s:complete(a,b,c)
> return ["foo", "bar", "baz"]
> endfunction
>
>
> command! -nargs=1 -complete=customlist,<SID>complete A123 echo <q-args>
>
> Below is a patch to tix this problem.

Thanks!


--
'Well, here's something to occupy you and keep your mind off things.'
'It won't work, I have an exceptionally large mind.'
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

/// Bram Moolenaar -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages