forked from aniani/vim
updated for version 7.3.072
Problem: Can't complete file names while ignoring case. Solution: Add 'wildignorecase'.
This commit is contained in:
parent
4161dccada
commit
94950a9ee0
@ -7752,6 +7752,17 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
a pattern from the list. This avoids problems when a future version
|
||||
uses another default.
|
||||
|
||||
|
||||
*'wildignorecase* *'wic'* *'nowildignorecase* *'nowic'*
|
||||
'wildignorecase' 'wic' boolean (default off)
|
||||
global
|
||||
{not in Vi}
|
||||
When set case is ignored when completing file names and directories.
|
||||
Has no effect on systems where file name case is generally ignored.
|
||||
Does not apply when the shell is used to expand wildcards, which
|
||||
happens when there are special characters.
|
||||
|
||||
|
||||
*'wildmenu'* *'wmnu'* *'nowildmenu'* *'nowmnu'*
|
||||
'wildmenu' 'wmnu' boolean (default off)
|
||||
global
|
||||
|
@ -4524,12 +4524,14 @@ expand_filename(eap, cmdlinep, errormsgp)
|
||||
else /* n == 2 */
|
||||
{
|
||||
expand_T xpc;
|
||||
int options = WILD_LIST_NOTFOUND|WILD_ADD_SLASH;
|
||||
|
||||
ExpandInit(&xpc);
|
||||
xpc.xp_context = EXPAND_FILES;
|
||||
if (p_wic)
|
||||
options += WILD_ICASE;
|
||||
p = ExpandOne(&xpc, eap->arg, NULL,
|
||||
WILD_LIST_NOTFOUND|WILD_ADD_SLASH,
|
||||
WILD_EXPAND_FREE);
|
||||
options, WILD_EXPAND_FREE);
|
||||
if (p == NULL)
|
||||
return FAIL;
|
||||
}
|
||||
|
@ -3339,10 +3339,14 @@ nextwild(xp, type, options)
|
||||
p2 = NULL;
|
||||
else
|
||||
{
|
||||
int use_options = options |
|
||||
WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE;
|
||||
|
||||
if (p_wic)
|
||||
use_options += WILD_ICASE;
|
||||
p2 = ExpandOne(xp, p1,
|
||||
vim_strnsave(&ccline.cmdbuff[i], xp->xp_pattern_len),
|
||||
WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE
|
||||
|options, type);
|
||||
use_options, type);
|
||||
vim_free(p1);
|
||||
/* longest match: make sure it is not shorter, happens with :help */
|
||||
if (p2 != NULL && type == WILD_LONGEST)
|
||||
@ -3428,6 +3432,7 @@ nextwild(xp, type, options)
|
||||
* options = WILD_KEEP_ALL: don't remove 'wildignore' entries
|
||||
* options = WILD_SILENT: don't print warning messages
|
||||
* options = WILD_ESCAPE: put backslash before special chars
|
||||
* options = WILD_ICASE: ignore case for files
|
||||
*
|
||||
* The variables xp->xp_context and xp->xp_backslash must have been set!
|
||||
*/
|
||||
@ -4361,6 +4366,7 @@ expand_cmdline(xp, str, col, matchcount, matches)
|
||||
char_u ***matches; /* return: array of pointers to matches */
|
||||
{
|
||||
char_u *file_str = NULL;
|
||||
int options = WILD_ADD_SLASH|WILD_SILENT;
|
||||
|
||||
if (xp->xp_context == EXPAND_UNSUCCESSFUL)
|
||||
{
|
||||
@ -4379,9 +4385,11 @@ expand_cmdline(xp, str, col, matchcount, matches)
|
||||
if (file_str == NULL)
|
||||
return EXPAND_UNSUCCESSFUL;
|
||||
|
||||
if (p_wic)
|
||||
options += WILD_ICASE;
|
||||
|
||||
/* find all files that match the description */
|
||||
if (ExpandFromContext(xp, file_str, matchcount, matches,
|
||||
WILD_ADD_SLASH|WILD_SILENT) == FAIL)
|
||||
if (ExpandFromContext(xp, file_str, matchcount, matches, options) == FAIL)
|
||||
{
|
||||
*matchcount = 0;
|
||||
*matches = NULL;
|
||||
@ -4433,7 +4441,7 @@ ExpandFromContext(xp, pat, num_file, file, options)
|
||||
char_u *pat;
|
||||
int *num_file;
|
||||
char_u ***file;
|
||||
int options;
|
||||
int options; /* EW_ flags */
|
||||
{
|
||||
#ifdef FEAT_CMDL_COMPL
|
||||
regmatch_T regmatch;
|
||||
@ -4487,6 +4495,9 @@ ExpandFromContext(xp, pat, num_file, file, options)
|
||||
flags |= (EW_FILE | EW_PATH);
|
||||
else
|
||||
flags = (flags | EW_DIR) & ~EW_FILE;
|
||||
if (options & WILD_ICASE)
|
||||
flags |= EW_ICASE;
|
||||
|
||||
/* Expand wildcards, supporting %:h and the like. */
|
||||
ret = expand_wildcards_eval(&pat, num_file, file, flags);
|
||||
if (free_pat)
|
||||
|
@ -9161,7 +9161,10 @@ unix_expandpath(gap, path, wildoff, flags, didstar)
|
||||
#ifdef CASE_INSENSITIVE_FILENAME
|
||||
regmatch.rm_ic = TRUE; /* Behave like Terminal.app */
|
||||
#else
|
||||
regmatch.rm_ic = FALSE; /* Don't ever ignore case */
|
||||
if (flags & EW_ICASE)
|
||||
regmatch.rm_ic = TRUE; /* 'wildignorecase' set */
|
||||
else
|
||||
regmatch.rm_ic = FALSE; /* Don't ignore case */
|
||||
#endif
|
||||
regmatch.regprog = vim_regcomp(pat, RE_MAGIC);
|
||||
vim_free(pat);
|
||||
@ -9643,7 +9646,7 @@ expand_in_path(gap, pattern, flags)
|
||||
if (paths == NULL)
|
||||
return 0;
|
||||
|
||||
files = globpath(paths, pattern, 0);
|
||||
files = globpath(paths, pattern, (flags & EW_ICASE) ? WILD_ICASE : 0);
|
||||
vim_free(paths);
|
||||
if (files == NULL)
|
||||
return 0;
|
||||
|
@ -2740,7 +2740,7 @@ static struct vimoption
|
||||
(char_u *)&p_wc, PV_NONE,
|
||||
{(char_u *)(long)Ctrl_E, (char_u *)(long)TAB}
|
||||
SCRIPTID_INIT},
|
||||
{"wildcharm", "wcm", P_NUM|P_VI_DEF,
|
||||
{"wildcharm", "wcm", P_NUM|P_VI_DEF,
|
||||
(char_u *)&p_wcm, PV_NONE,
|
||||
{(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
|
||||
{"wildignore", "wig", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
||||
@ -2750,6 +2750,9 @@ static struct vimoption
|
||||
(char_u *)NULL, PV_NONE,
|
||||
#endif
|
||||
{(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
|
||||
{"wildignorecase", "wic", P_BOOL|P_VI_DEF,
|
||||
(char_u *)&p_wic, PV_NONE,
|
||||
{(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
|
||||
{"wildmenu", "wmnu", P_BOOL|P_VI_DEF,
|
||||
#ifdef FEAT_WILDMENU
|
||||
(char_u *)&p_wmnu, PV_NONE,
|
||||
|
@ -872,6 +872,7 @@ EXTERN int p_wiv; /* 'weirdinvert' */
|
||||
EXTERN char_u *p_ww; /* 'whichwrap' */
|
||||
EXTERN long p_wc; /* 'wildchar' */
|
||||
EXTERN long p_wcm; /* 'wildcharm' */
|
||||
EXTERN long p_wic; /* 'wildignorecase' */
|
||||
EXTERN char_u *p_wim; /* 'wildmode' */
|
||||
#ifdef FEAT_WILDMENU
|
||||
EXTERN int p_wmnu; /* 'wildmenu' */
|
||||
|
@ -714,6 +714,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
72,
|
||||
/**/
|
||||
71,
|
||||
/**/
|
||||
|
@ -798,6 +798,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
|
||||
#define WILD_KEEP_ALL 32
|
||||
#define WILD_SILENT 64
|
||||
#define WILD_ESCAPE 128
|
||||
#define WILD_ICASE 256
|
||||
|
||||
/* Flags for expand_wildcards() */
|
||||
#define EW_DIR 0x01 /* include directory names */
|
||||
@ -808,6 +809,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
|
||||
#define EW_SILENT 0x20 /* don't print "1 returned" from shell */
|
||||
#define EW_EXEC 0x40 /* executable files */
|
||||
#define EW_PATH 0x80 /* search in 'path' too */
|
||||
#define EW_ICASE 0x100 /* ignore case */
|
||||
/* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND
|
||||
* is used when executing commands and EW_SILENT for interactive expanding. */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user