-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
invalid back reference on MSYS2 #538
Comments
Just experienced an issue with this same line in Example of my issue with this line caused by [ ] in fname: let fname = 'D:\test\.vimrc [automatic-backup].vimrc'
let absolute_path = glob(fnamemodify(fname, ":p"))
E944: Reverse range in character class Doing this before fnamemodify(...) will fix my issue but more robust special-character escaping is needed for all cases: let fname = substitute(fname, '\[', '\\\[', 'g')
let fname = substitute(fname, '\]', '\\\]', 'g') EDIT: No the above fix only stops the error from occurring. |
By
therefore something like if exists('+shellslash') && !&shellslash
" win32
let fname = substitute(fname, '\([[\]*?]\)', '\\[\1]', 'g')
else
let fname = substitute(fname, '\([[\]*?\\]\)', '\\\1', 'g')
endif should work |
The win32 section needs some changes. Its causing files like let fname = 'D:\test\.vimrc [automatic-backup].vimrc'
" win32
let fname = substitute(fname, '\([[\]*?]\)', '\\[\1]', 'g')
echo fname
" D:\test\.vimrc \[[]automatic-backup\[]].vimrc I think it should be: The following fixes the win32 side: if exists('+shellslash') && !&shellslash
" win32
let fname = substitute(fname, '\[', '\[[]', 'g')
" Don't think this line is needed. Windows paths can't contain '*' and '?' (well there are exceptions to this, like DOS device paths can contain '?', https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats but i don't think they need to be escaped.
let fname = substitute(fname, '\([*?]\)', '\\\1', 'g')
else
let fname = substitute(fname, '\([[\]*?\\]\)', '\\\1', 'g')
endif |
Updated accordingly, though in |
Good question. I copied the :h substitute() |
Hello,
the line
vim-startify/autoload/startify.vim
Line 662 in 81e36c3
leads to an error message
as shown by
if v:oldfiles contains file paths with back and forward slashes (as happens when using Vim in MSYS2 and Windows).
Maybe the slashes should be all converted to
\
and to
/
otherwise?The text was updated successfully, but these errors were encountered: