-
-
Notifications
You must be signed in to change notification settings - Fork 205
Fix [f
and ]f
behavior in directory containing [
, $
#232
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
Conversation
Without this, glob() fails to list files and [f/]f works incorrectly when a path contains a special character such as "[".
|
[f
and ]f
behavior in directory with special character[f
and ]f
behavior in directory containing [
688c135
to
359ac0e
Compare
[f
and ]f
behavior in directory containing [
[f
and ]f
behavior in directory containing [
, $
plugin/unimpaired.vim
Outdated
@@ -77,6 +77,7 @@ call s:MapNextFamily('t', 't', 'trewind') | |||
|
|||
function! s:entries(path) abort | |||
let path = substitute(a:path,'[\\/]$','','') | |||
let path = substitute(path, '\([\|\$\)', '[\1]', 'g') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try substitute(path, '[[$*]', '[&]', 'g')
to make it a bit cleaner. I threw *
in there also for good measure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for quick advice. I updated the code and confirmed it works!
dd00e8a
see :help wildcards. Escaping by adding a backslash does not work on Windows.
359ac0e
to
dd00e8a
Compare
Thank you for pointing it out. I didn't know that. I updated the code to escape |
Without this, glob() fails to list files and [f/]f works incorrectly when a path contains a special character such as "[". Resolves: tpope#232
Currently
s:entries()
lists file paths usingglob()
without escaping filename, so it works incorrectly when a directory name contains a special character such as[
. This PR fixes that and make[f
and]f
work for such directories.