updated for version 7.2-051

This commit is contained in:
Bram Moolenaar
2008-11-28 10:01:10 +00:00
parent 3f3766b60d
commit bb5ddda46a
6 changed files with 60 additions and 30 deletions

View File

@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.2. Last change: 2008 Nov 02 *eval.txt* For Vim version 7.2. Last change: 2008 Nov 27
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -1706,7 +1706,7 @@ executable( {expr}) Number 1 if executable {expr} exists
exists( {expr}) Number TRUE if {expr} exists exists( {expr}) Number TRUE if {expr} exists
extend({expr1}, {expr2} [, {expr3}]) extend({expr1}, {expr2} [, {expr3}])
List/Dict insert items of {expr2} into {expr1} List/Dict insert items of {expr2} into {expr1}
expand( {expr}) String expand special keywords in {expr} expand( {expr} [, {flag}]) String expand special keywords in {expr}
feedkeys( {string} [, {mode}]) Number add key sequence to typeahead buffer feedkeys( {string} [, {mode}]) Number add key sequence to typeahead buffer
filereadable( {file}) Number TRUE if {file} is a readable file filereadable( {file}) Number TRUE if {file} is a readable file
filewritable( {file}) Number TRUE if {file} is a writable file filewritable( {file}) Number TRUE if {file} is a writable file
@ -1758,8 +1758,9 @@ gettabwinvar( {tabnr}, {winnr}, {name})
getwinposx() Number X coord in pixels of GUI Vim window getwinposx() Number X coord in pixels of GUI Vim window
getwinposy() Number Y coord in pixels of GUI Vim window getwinposy() Number Y coord in pixels of GUI Vim window
getwinvar( {nr}, {varname}) any variable {varname} in window {nr} getwinvar( {nr}, {varname}) any variable {varname} in window {nr}
glob( {expr}) String expand file wildcards in {expr} glob( {expr} [, {flag}]) String expand file wildcards in {expr}
globpath( {path}, {expr}) String do glob({expr}) for all dirs in {path} globpath( {path}, {expr} [, {flag}])
String do glob({expr}) for all dirs in {path}
has( {feature}) Number TRUE if feature {feature} supported has( {feature}) Number TRUE if feature {feature} supported
has_key( {dict}, {key}) Number TRUE if {dict} has entry {key} has_key( {dict}, {key}) Number TRUE if {dict} has entry {key}
haslocaldir() Number TRUE if current window executed |:lcd| haslocaldir() Number TRUE if current window executed |:lcd|
@ -3286,14 +3287,16 @@ getwinvar({winnr}, {varname}) *getwinvar()*
:let list_is_on = getwinvar(2, '&list') :let list_is_on = getwinvar(2, '&list')
:echo "myvar = " . getwinvar(1, 'myvar') :echo "myvar = " . getwinvar(1, 'myvar')
< <
*glob()* glob({expr} [, {flag}]) *glob()*
glob({expr}) Expand the file wildcards in {expr}. See |wildcards| for the Expand the file wildcards in {expr}. See |wildcards| for the
use of special characters. use of special characters.
The result is a String. The result is a String.
When there are several matches, they are separated by <NL> When there are several matches, they are separated by <NL>
characters. characters.
The 'wildignore' option applies: Names matching one of the Unless the optional {flag} argument is given and is non-zero,
patterns in 'wildignore' will be skipped. the 'suffixes' and 'wildignore' options apply: Names matching
one of the patterns in 'wildignore' will be skipped and
'suffixes' affect the ordering of matches.
If the expansion fails, the result is an empty string. If the expansion fails, the result is an empty string.
A name for a non-existing file is not included. A name for a non-existing file is not included.
@ -3307,20 +3310,22 @@ glob({expr}) Expand the file wildcards in {expr}. See |wildcards| for the
See |expand()| for expanding special Vim variables. See See |expand()| for expanding special Vim variables. See
|system()| for getting the raw output of an external command. |system()| for getting the raw output of an external command.
globpath({path}, {expr}) *globpath()* globpath({path}, {expr} [, {flag}]) *globpath()*
Perform glob() on all directories in {path} and concatenate Perform glob() on all directories in {path} and concatenate
the results. Example: > the results. Example: >
:echo globpath(&rtp, "syntax/c.vim") :echo globpath(&rtp, "syntax/c.vim")
< {path} is a comma-separated list of directory names. Each < {path} is a comma-separated list of directory names. Each
directory name is prepended to {expr} and expanded like with directory name is prepended to {expr} and expanded like with
glob(). A path separator is inserted when needed. |glob()|. A path separator is inserted when needed.
To add a comma inside a directory name escape it with a To add a comma inside a directory name escape it with a
backslash. Note that on MS-Windows a directory may have a backslash. Note that on MS-Windows a directory may have a
trailing backslash, remove it if you put a comma after it. trailing backslash, remove it if you put a comma after it.
If the expansion fails for one of the directories, there is no If the expansion fails for one of the directories, there is no
error message. error message.
The 'wildignore' option applies: Names matching one of the Unless the optional {flag} argument is given and is non-zero,
patterns in 'wildignore' will be skipped. the 'suffixes' and 'wildignore' options apply: Names matching
one of the patterns in 'wildignore' will be skipped and
'suffixes' affect the ordering of matches.
The "**" item can be used to search in a directory tree. The "**" item can be used to search in a directory tree.
For example, to find all "README.txt" files in the directories For example, to find all "README.txt" files in the directories

View File

@ -1,4 +1,4 @@
*options.txt* For Vim version 7.2. Last change: 2008 Aug 06 *options.txt* For Vim version 7.2. Last change: 2008 Nov 25
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -7472,7 +7472,9 @@ A jump table for the options with a short description can be found at |Q_op|.
{not available when compiled without the |+wildignore| {not available when compiled without the |+wildignore|
feature} feature}
A list of file patterns. A file that matches with one of these A list of file patterns. A file that matches with one of these
patterns is ignored when completing file or directory names. patterns is ignored when completing file or directory names, and
influences the result of |expand()|, |glob()| and |globpath()| unless
a flag is passed to disable this.
The pattern is used like with |:autocmd|, see |autocmd-patterns|. The pattern is used like with |:autocmd|, see |autocmd-patterns|.
Also see 'suffixes'. Also see 'suffixes'.
Example: > Example: >

View File

@ -7564,8 +7564,8 @@ static struct fst
{"getwinposx", 0, 0, f_getwinposx}, {"getwinposx", 0, 0, f_getwinposx},
{"getwinposy", 0, 0, f_getwinposy}, {"getwinposy", 0, 0, f_getwinposy},
{"getwinvar", 2, 2, f_getwinvar}, {"getwinvar", 2, 2, f_getwinvar},
{"glob", 1, 1, f_glob}, {"glob", 1, 2, f_glob},
{"globpath", 2, 2, f_globpath}, {"globpath", 2, 3, f_globpath},
{"has", 1, 1, f_has}, {"has", 1, 1, f_has},
{"has_key", 2, 2, f_has_key}, {"has_key", 2, 2, f_has_key},
{"haslocaldir", 0, 0, f_haslocaldir}, {"haslocaldir", 0, 0, f_haslocaldir},
@ -9557,7 +9557,7 @@ f_expand(argvars, rettv)
else else
{ {
/* When the optional second argument is non-zero, don't remove matches /* When the optional second argument is non-zero, don't remove matches
* for 'suffixes' and 'wildignore' */ * for 'wildignore' and don't put matches for 'suffixes' at the end. */
if (argvars[1].v_type != VAR_UNKNOWN if (argvars[1].v_type != VAR_UNKNOWN
&& get_tv_number_chk(&argvars[1], &error)) && get_tv_number_chk(&argvars[1], &error))
flags |= WILD_KEEP_ALL; flags |= WILD_KEEP_ALL;
@ -11323,13 +11323,25 @@ f_glob(argvars, rettv)
typval_T *argvars; typval_T *argvars;
typval_T *rettv; typval_T *rettv;
{ {
int flags = WILD_SILENT|WILD_USE_NL;
expand_T xpc; expand_T xpc;
int error = FALSE;
ExpandInit(&xpc); /* When the optional second argument is non-zero, don't remove matches
xpc.xp_context = EXPAND_FILES; * for 'wildignore' and don't put matches for 'suffixes' at the end. */
if (argvars[1].v_type != VAR_UNKNOWN
&& get_tv_number_chk(&argvars[1], &error))
flags |= WILD_KEEP_ALL;
rettv->v_type = VAR_STRING; rettv->v_type = VAR_STRING;
rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]), if (!error)
NULL, WILD_USE_NL|WILD_SILENT, WILD_ALL); {
ExpandInit(&xpc);
xpc.xp_context = EXPAND_FILES;
rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
NULL, flags, WILD_ALL);
}
else
rettv->vval.v_string = NULL;
} }
/* /*
@ -11340,14 +11352,22 @@ f_globpath(argvars, rettv)
typval_T *argvars; typval_T *argvars;
typval_T *rettv; typval_T *rettv;
{ {
int flags = 0;
char_u buf1[NUMBUFLEN]; char_u buf1[NUMBUFLEN];
char_u *file = get_tv_string_buf_chk(&argvars[1], buf1); char_u *file = get_tv_string_buf_chk(&argvars[1], buf1);
int error = FALSE;
/* When the optional second argument is non-zero, don't remove matches
* for 'wildignore' and don't put matches for 'suffixes' at the end. */
if (argvars[2].v_type != VAR_UNKNOWN
&& get_tv_number_chk(&argvars[2], &error))
flags |= WILD_KEEP_ALL;
rettv->v_type = VAR_STRING; rettv->v_type = VAR_STRING;
if (file == NULL) if (file == NULL || error)
rettv->vval.v_string = NULL; rettv->vval.v_string = NULL;
else else
rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file); rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file,
flags);
} }
/* /*

View File

@ -2524,7 +2524,7 @@ realloc_cmdbuff(len)
&& ccline.xpc->xp_context != EXPAND_NOTHING && ccline.xpc->xp_context != EXPAND_NOTHING
&& ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL) && ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL)
{ {
int i = ccline.xpc->xp_pattern - p; int i = (int)(ccline.xpc->xp_pattern - p);
/* If xp_pattern points inside the old cmdbuff it needs to be adjusted /* If xp_pattern points inside the old cmdbuff it needs to be adjusted
* to point into the newly allocated memory. */ * to point into the newly allocated memory. */
@ -4897,7 +4897,7 @@ ExpandRTDir(pat, num_file, file, dirname)
if (s == NULL) if (s == NULL)
return FAIL; return FAIL;
sprintf((char *)s, "%s/%s*.vim", dirname, pat); sprintf((char *)s, "%s/%s*.vim", dirname, pat);
all = globpath(p_rtp, s); all = globpath(p_rtp, s, 0);
vim_free(s); vim_free(s);
if (all == NULL) if (all == NULL)
return FAIL; return FAIL;
@ -4938,9 +4938,10 @@ ExpandRTDir(pat, num_file, file, dirname)
* newlines. Returns NULL for an error or no matches. * newlines. Returns NULL for an error or no matches.
*/ */
char_u * char_u *
globpath(path, file) globpath(path, file, expand_options)
char_u *path; char_u *path;
char_u *file; char_u *file;
int expand_options;
{ {
expand_T xpc; expand_T xpc;
char_u *buf; char_u *buf;
@ -4969,10 +4970,10 @@ globpath(path, file)
{ {
add_pathsep(buf); add_pathsep(buf);
STRCAT(buf, file); STRCAT(buf, file);
if (ExpandFromContext(&xpc, buf, &num_p, &p, WILD_SILENT) != FAIL if (ExpandFromContext(&xpc, buf, &num_p, &p,
&& num_p > 0) WILD_SILENT|expand_options) != FAIL && num_p > 0)
{ {
ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT); ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options);
for (len = 0, i = 0; i < num_p; ++i) for (len = 0, i = 0; i < num_p; ++i)
len += (int)STRLEN(p[i]) + 1; len += (int)STRLEN(p[i]) + 1;

View File

@ -31,7 +31,7 @@ char_u *addstar __ARGS((char_u *fname, int len, int context));
void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col)); void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col));
int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches)); int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches));
int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int)))); int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int))));
char_u *globpath __ARGS((char_u *path, char_u *file)); char_u *globpath __ARGS((char_u *path, char_u *file, int expand_options));
void init_history __ARGS((void)); void init_history __ARGS((void));
int get_histtype __ARGS((char_u *name)); int get_histtype __ARGS((char_u *name));
void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep)); void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep));

View File

@ -676,6 +676,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
51,
/**/ /**/
50, 50,
/**/ /**/