summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/map.txt36
-rw-r--r--src/ex_docmd.c9
-rw-r--r--src/gui_at_fs.c2
-rw-r--r--src/os_vms.c2
-rw-r--r--src/os_win32.c2
-rw-r--r--src/po/Make_cyg.mak6
-rw-r--r--src/vim.h1
7 files changed, 41 insertions, 17 deletions
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index 18da9ccc0..a42b744af 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 <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,
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index ebfac55fd..4a83ca013 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -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;
diff --git a/src/gui_at_fs.c b/src/gui_at_fs.c
index 474967ecb..3ded71152 100644
--- a/src/gui_at_fs.c
+++ b/src/gui_at_fs.c
@@ -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);
diff --git a/src/os_vms.c b/src/os_vms.c
index 6fd05d503..ff3bf2c16 100644
--- a/src/os_vms.c
+++ b/src/os_vms.c
@@ -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));
diff --git a/src/os_win32.c b/src/os_win32.c
index 77a96c949..6ad674e2d 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -4828,7 +4828,7 @@ myresetstkoflw(void)
* committed block. */
BYTE *pBlock = pStackBase;
- while (1)
+ for (;;)
{
if (VirtualQuery(pBlock, &mbi, sizeof mbi) == 0)
return 0;
diff --git a/src/po/Make_cyg.mak b/src/po/Make_cyg.mak
index f39368f9e..e306ccb9e 100644
--- a/src/po/Make_cyg.mak
+++ b/src/po/Make_cyg.mak
@@ -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
diff --git a/src/vim.h b/src/vim.h
index c8a4b6398..20273b396 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -648,6 +648,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
#define EXPAND_COLORS 28
#define EXPAND_COMPILER 29
#define EXPAND_USER_DEFINED 30
+#define EXPAND_USER_LIST 31
/* Values for exmode_active (0 is no exmode) */
#define EXMODE_NORMAL 1