From a466c99842c4b482c847b6336aae458509963dcd Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 9 Jul 2005 21:03:22 +0000 Subject: updated for version 7.0106 --- runtime/doc/map.txt | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'runtime/doc/map.txt') diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 18da9ccc06..a42b744afc 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -932,26 +932,36 @@ completion can be enabled: -complete=tag_listfiles tags, file names are shown when CTRL-D is hit -complete=var user variables -complete=custom,{func} custom completion, defined via {func} + -complete=customlist,{func} custom completion, defined via {func} Custom completion *:command-completion-custom* *E467* *E468* It is possible to define customized completion schemes via the "custom,{func}" -completion argument. The {func} part should be a function with the following -prototype > +or the "customlist,{func}" completion argument. The {func} part should be a +function with the following prototype > :function {func}(ArgLead, CmdLine, CursorPos) -The function need not use all these arguments, but it should provide the -completion candidates as the return value, one per line in a newline separated -string. The function arguments are: +The function need not use all these arguments. The function should provide the +completion candidates as the return value. + +For the "custom" argument, the function should return the completion +candidates one per line in a newline separated string. + +For the "customlist" argument, the function should return the completion +candidates as a Vim List. Non-string items in the list are ignored. + +The function arguments are: ArgLead the leading portion of the argument currently being completed on CmdLine the entire command line CursorPos the cursor position in it -The function may use these for determining context. It is not necessary to -filter candidates against the (implicit pattern in) ArgLead. Vim will do -filter the candidates with its regexp engine after function return, and this -is probably more efficient in most cases. +The function may use these for determining context. For the "custom" +argument, it is not necessary to filter candidates against the (implicit +pattern in) ArgLead. Vim will do filter the candidates with its regexp engine +after function return, and this is probably more efficient in most cases. For +the "customlist" argument, Vim will not filter the returned completion +candidates and the user supplied function should filter the candidates. The following example lists user names to a Finger command > :com -complete=custom,ListUsers -nargs=1 Finger !finger @@ -959,6 +969,14 @@ The following example lists user names to a Finger command > : return system("cut -d: -f1 /etc/passwd") :endfun +The following example completes filenames from the directories specified in +the 'path' option: > + :com -nargs=1 -bang -complete=customlist,EditFileComplete + \ EditFile edit + :fun EditFileComplete(A,L,P) + : return split(globpath(&path, a:ArgLead)) + :endfun +< Range handling *E177* *E178* By default, user-defined commands do not accept a line number range. However, -- cgit v1.2.3