1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: Can't complete file names while ignoring case.
12 Solution: Add 'wildignorecase'.
13 Files: src/ex_docmd.c, src/ex_getln.c, src/misc1.c, src/option.c,
14 src/option.h, src/vim.h, runtime/doc/options.txt
17 *** ../vim-7.3.071/src/ex_docmd.c 2010-11-24 15:50:54.000000000 +0100
18 --- src/ex_docmd.c 2010-12-02 15:58:10.000000000 +0100
26 xpc.xp_context = EXPAND_FILES;
27 p = ExpandOne(&xpc, eap->arg, NULL,
28 ! WILD_LIST_NOTFOUND|WILD_ADD_SLASH,
37 + int options = WILD_LIST_NOTFOUND|WILD_ADD_SLASH;
40 xpc.xp_context = EXPAND_FILES;
42 + options += WILD_ICASE;
43 p = ExpandOne(&xpc, eap->arg, NULL,
44 ! options, WILD_EXPAND_FREE);
48 *** ../vim-7.3.071/src/ex_getln.c 2010-11-16 14:05:48.000000000 +0100
49 --- src/ex_getln.c 2010-11-28 15:07:49.000000000 +0100
55 p2 = ExpandOne(xp, p1,
56 vim_strnsave(&ccline.cmdbuff[i], xp->xp_pattern_len),
57 ! WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE
60 /* longest match: make sure it is not shorter, happens with :help */
61 if (p2 != NULL && type == WILD_LONGEST)
66 + int use_options = options |
67 + WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE;
70 + use_options += WILD_ICASE;
71 p2 = ExpandOne(xp, p1,
72 vim_strnsave(&ccline.cmdbuff[i], xp->xp_pattern_len),
75 /* longest match: make sure it is not shorter, happens with :help */
76 if (p2 != NULL && type == WILD_LONGEST)
80 * options = WILD_KEEP_ALL: don't remove 'wildignore' entries
81 * options = WILD_SILENT: don't print warning messages
82 * options = WILD_ESCAPE: put backslash before special chars
83 + * options = WILD_ICASE: ignore case for files
85 * The variables xp->xp_context and xp->xp_backslash must have been set!
90 char_u ***matches; /* return: array of pointers to matches */
92 char_u *file_str = NULL;
93 + int options = WILD_ADD_SLASH|WILD_SILENT;
95 if (xp->xp_context == EXPAND_UNSUCCESSFUL)
100 return EXPAND_UNSUCCESSFUL;
102 /* find all files that match the description */
103 ! if (ExpandFromContext(xp, file_str, matchcount, matches,
104 ! WILD_ADD_SLASH|WILD_SILENT) == FAIL)
109 if (file_str == NULL)
110 return EXPAND_UNSUCCESSFUL;
113 + options += WILD_ICASE;
115 /* find all files that match the description */
116 ! if (ExpandFromContext(xp, file_str, matchcount, matches, options) == FAIL)
127 #ifdef FEAT_CMDL_COMPL
133 ! int options; /* EW_ flags */
135 #ifdef FEAT_CMDL_COMPL
140 flags |= (EW_FILE | EW_PATH);
142 flags = (flags | EW_DIR) & ~EW_FILE;
143 + if (options & WILD_ICASE)
146 /* Expand wildcards, supporting %:h and the like. */
147 ret = expand_wildcards_eval(&pat, num_file, file, flags);
149 *** ../vim-7.3.071/src/misc1.c 2010-08-16 21:46:12.000000000 +0200
150 --- src/misc1.c 2010-11-28 15:02:57.000000000 +0100
153 #ifdef CASE_INSENSITIVE_FILENAME
154 regmatch.rm_ic = TRUE; /* Behave like Terminal.app */
156 ! regmatch.rm_ic = FALSE; /* Don't ever ignore case */
158 regmatch.regprog = vim_regcomp(pat, RE_MAGIC);
161 #ifdef CASE_INSENSITIVE_FILENAME
162 regmatch.rm_ic = TRUE; /* Behave like Terminal.app */
164 ! if (flags & EW_ICASE)
165 ! regmatch.rm_ic = TRUE; /* 'wildignorecase' set */
167 ! regmatch.rm_ic = FALSE; /* Don't ignore case */
169 regmatch.regprog = vim_regcomp(pat, RE_MAGIC);
176 ! files = globpath(paths, pattern, 0);
184 ! files = globpath(paths, pattern, (flags & EW_ICASE) ? WILD_ICASE : 0);
188 *** ../vim-7.3.071/src/option.c 2010-12-02 15:33:10.000000000 +0100
189 --- src/option.c 2010-12-02 15:12:02.000000000 +0100
192 (char_u *)&p_wc, PV_NONE,
193 {(char_u *)(long)Ctrl_E, (char_u *)(long)TAB}
195 ! {"wildcharm", "wcm", P_NUM|P_VI_DEF,
196 (char_u *)&p_wcm, PV_NONE,
197 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
198 {"wildignore", "wig", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
200 (char_u *)&p_wc, PV_NONE,
201 {(char_u *)(long)Ctrl_E, (char_u *)(long)TAB}
203 ! {"wildcharm", "wcm", P_NUM|P_VI_DEF,
204 (char_u *)&p_wcm, PV_NONE,
205 {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
206 {"wildignore", "wig", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
210 (char_u *)NULL, PV_NONE,
212 {(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
213 + {"wildignorecase", "wic", P_BOOL|P_VI_DEF,
214 + (char_u *)&p_wic, PV_NONE,
215 + {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
216 {"wildmenu", "wmnu", P_BOOL|P_VI_DEF,
218 (char_u *)&p_wmnu, PV_NONE,
219 *** ../vim-7.3.071/src/option.h 2010-08-15 21:57:28.000000000 +0200
220 --- src/option.h 2010-11-28 14:29:18.000000000 +0100
224 EXTERN char_u *p_ww; /* 'whichwrap' */
225 EXTERN long p_wc; /* 'wildchar' */
226 EXTERN long p_wcm; /* 'wildcharm' */
227 + EXTERN long p_wic; /* 'wildignorecase' */
228 EXTERN char_u *p_wim; /* 'wildmode' */
230 EXTERN int p_wmnu; /* 'wildmenu' */
231 *** ../vim-7.3.071/src/vim.h 2010-10-20 19:17:43.000000000 +0200
232 --- src/vim.h 2010-11-28 14:49:02.000000000 +0100
236 #define WILD_KEEP_ALL 32
237 #define WILD_SILENT 64
238 #define WILD_ESCAPE 128
239 + #define WILD_ICASE 256
241 /* Flags for expand_wildcards() */
242 #define EW_DIR 0x01 /* include directory names */
246 #define EW_SILENT 0x20 /* don't print "1 returned" from shell */
247 #define EW_EXEC 0x40 /* executable files */
248 #define EW_PATH 0x80 /* search in 'path' too */
249 + #define EW_ICASE 0x100 /* ignore case */
250 /* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND
251 * is used when executing commands and EW_SILENT for interactive expanding. */
253 *** ../vim-7.3.071/runtime/doc/options.txt 2010-10-20 17:44:01.000000000 +0200
254 --- runtime/doc/options.txt 2010-12-02 11:15:01.000000000 +0100
258 a pattern from the list. This avoids problems when a future version
259 uses another default.
262 + *'wildignorecase* *'wic'* *'nowildignorecase* *'nowic'*
263 + 'wildignorecase' 'wic' boolean (default off)
266 + When set case is ignored when completing file names and directories.
267 + Has no effect on systems where file name case is generally ignored.
268 + Does not apply when the shell is used to expand wildcards, which
269 + happens when there are special characters.
272 *'wildmenu'* *'wmnu'* *'nowildmenu'* *'nowmnu'*
273 'wildmenu' 'wmnu' boolean (default off)
275 *** ../vim-7.3.071/src/version.c 2010-12-02 15:33:10.000000000 +0100
276 --- src/version.c 2010-12-02 15:57:14.000000000 +0100
280 { /* Add new patch number below this line */
286 I recommend ordering large cargo containers of paper towels to make up
287 whatever budget underruns you have. Paper products are always useful and they
288 have the advantage of being completely flushable if you need to make room in
289 the storage area later.
290 (Scott Adams - The Dilbert principle)
292 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
293 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
294 \\\ an exciting new programming language -- http://www.Zimbu.org ///
295 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///