Skip to content

Commit 95b4070

Browse files
committed
An additional backslash is needed on Windows.
1 parent e49fc5d commit 95b4070

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

autoload/startuptime.vim

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ endfunction
179179
function! s:SetFile() abort
180180
let l:isfname = &isfname
181181
" On Windows, to escape '[' with a backslash below, the character has to be
182-
" removed from 'isfname' (see ':help wilcard').
182+
" removed from 'isfname' (:help wilcard).
183183
set isfname-=[
184184
let l:n = 0
185185
while 1
@@ -188,9 +188,13 @@ function! s:SetFile() abort
188188
if l:n ># 0
189189
let l:text .= '.' . l:n
190190
endif
191-
" Prepend backslash to avoid the special wildcard meaning (see ':help
192-
" wildcard'). Issue #9.
193-
execute 'silent file \[' . l:text . ']'
191+
" Prepend backslash to the prefix to avoid the special wildcard meaning
192+
" (:help wildcard). Two backslashes are necessary on Windows, since Vim
193+
" removes backslashes before special characters (:help dos-backslash).
194+
" Issue #9.
195+
let l:prefix = has('win32') ? '\\[' : '\['
196+
let l:suffix = ']'
197+
execute 'silent file ' . l:prefix . l:text . l:suffix
194198
catch
195199
let l:n += 1
196200
continue

0 commit comments

Comments
 (0)