mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
updated for version 7.0106
This commit is contained in:
@@ -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 <args>
|
||||
@@ -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<bang> <args>
|
||||
: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,
|
||||
|
@@ -3252,7 +3252,7 @@ set_one_cmd_context(xp, buff)
|
||||
++xp->xp_pattern;
|
||||
#if defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)
|
||||
/* Avoid that the assignment uses EXPAND_FILES again. */
|
||||
if (compl != EXPAND_USER_DEFINED)
|
||||
if (compl != EXPAND_USER_DEFINED && compl != EXPAND_USER_LIST)
|
||||
compl = EXPAND_ENV_VARS;
|
||||
#endif
|
||||
}
|
||||
@@ -4992,6 +4992,7 @@ static struct
|
||||
{EXPAND_COMMANDS, "command"},
|
||||
#if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
|
||||
{EXPAND_USER_DEFINED, "custom"},
|
||||
{EXPAND_USER_LIST, "customlist"},
|
||||
#endif
|
||||
{EXPAND_DIRECTORIES, "dir"},
|
||||
{EXPAND_ENV_VARS, "environment"},
|
||||
@@ -5301,7 +5302,8 @@ invalid_count:
|
||||
return FAIL;
|
||||
}
|
||||
#if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
|
||||
if (*compl != EXPAND_USER_DEFINED && arg != NULL)
|
||||
if (*compl != EXPAND_USER_DEFINED && *compl != EXPAND_USER_LIST &&
|
||||
arg != NULL)
|
||||
#else
|
||||
if (arg != NULL)
|
||||
#endif
|
||||
@@ -5310,7 +5312,8 @@ invalid_count:
|
||||
return FAIL;
|
||||
}
|
||||
#if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
|
||||
if (*compl == EXPAND_USER_DEFINED && arg == NULL)
|
||||
if ((*compl == EXPAND_USER_DEFINED || *compl == EXPAND_USER_LIST) &&
|
||||
arg == NULL)
|
||||
{
|
||||
EMSG(_("E467: Custom completion requires a function argument"));
|
||||
return FAIL;
|
||||
|
@@ -2855,7 +2855,7 @@ vim_SelFile(toplevel, prompt, init_path, show_entry, x, y, fg, bg, scroll_fg, sc
|
||||
SFdirModTimerId = XtAppAddTimeOut(SFapp, (unsigned long) 1000,
|
||||
SFdirModTimer, (XtPointer) NULL);
|
||||
|
||||
while (1)
|
||||
for (;;)
|
||||
{
|
||||
XtAppNextEvent(SFapp, &event);
|
||||
XtDispatchEvent(&event);
|
||||
|
@@ -317,7 +317,7 @@ vms_read(char *inbuf, size_t nbytes)
|
||||
function = (IO$_READLBLK | IO$M_EXTEND);
|
||||
memset(inbuf, 0, nbytes);
|
||||
|
||||
while (1)
|
||||
for (;;)
|
||||
{
|
||||
status = sys$qiow(0, iochan, function, &iosb, 0, 0, inbuf, nbytes - 1,
|
||||
0, 0, &itmlst, sizeof(itmlst));
|
||||
|
@@ -4828,7 +4828,7 @@ myresetstkoflw(void)
|
||||
* committed block. */
|
||||
BYTE *pBlock = pStackBase;
|
||||
|
||||
while (1)
|
||||
for (;;)
|
||||
{
|
||||
if (VirtualQuery(pBlock, &mbi, sizeof mbi) == 0)
|
||||
return 0;
|
||||
|
@@ -13,10 +13,12 @@ VIMRUNTIME = ../../runtime
|
||||
endif
|
||||
|
||||
LANGUAGES = af ca cs de en_GB es fr ga it ja ko no pl ru sk sv uk vi zh_TW \
|
||||
zh_TW.UTF-8 zh_CN zh_CN.UTF-8
|
||||
cs.cp1250 ja.sjis pl.cp1250 ru.cp1251 sk.cp1250 uk.cp1251 \
|
||||
zh_TW.UTF-8 zh_CN zh_CN.cp936 zh_CN.UTF-8
|
||||
MOFILES = af.mo ca.mo cs.mo de.mo en_GB.mo es.mo fr.mo ga.mo it.mo ja.mo \
|
||||
ko.mo no.mo pl.mo ru.mo sk.mo sv.mo uk.mo vi.mo \
|
||||
zh_TW.mo zh_TW.UTF-8.mo zh_CN.mo zh_CN.UTF-8.mo
|
||||
cs.cp1250.mo ja.sjis.mo pl.cp1250.mo ru.cp1251.mo sk.cp1250.mo uk.cp1251.mo \
|
||||
zh_TW.mo zh_TW.UTF-8.mo zh_CN.mo zh_CN.cp936.mo zh_CN.UTF-8.mo
|
||||
|
||||
PACKAGE = vim
|
||||
|
||||
|
Reference in New Issue
Block a user