-
Notifications
You must be signed in to change notification settings - Fork 71
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
Reverse range in character class #122
Comments
Thank you for the clear bug report along with steps to reproduce :) The "Reverse range in character class" error means that Vim is treating the folder name as a regexp; and :echo 's' =~ '[r-t]' " => 1
:echo 's' =~ '[t-r]' " => E944: Reverse range in character class Of course the code should be treating the name as a literal, not a regexp. I'll fix it up. |
The underlying problem is that when Rooter searches for "has" patterns, which are the most common, it uses So the problem is that even if your rooter patterns don't contain any wildcards, if you use "has" patterns and any of your files' ancestor directories contain wildcards, you'll get this undesired behaviour. I had hoped that only the rooter pattern would be treated as a glob, not the directory too. |
Does this patch solve the problem for you? diff --git i/plugin/rooter.vim w/plugin/rooter.vim
index 4573cbd..55b6b18 100644
--- i/plugin/rooter.vim
+++ w/plugin/rooter.vim
@@ -166,7 +166,7 @@ endfunction
" dir - full path to a directory
" identifier - a file name or a directory name; may be a glob
function! s:has(dir, identifier)
- return !empty(globpath(a:dir, a:identifier, 1))
+ return !empty(globpath(escape(a:dir, '?*[]'), a:identifier, 1))
endfunction
|
Thanks for confirming. |
Description
Sometimes when I open files with some characters in a directory's name in file path, vim-rooter prints an error.
The problem seems to be related to these symbols:
-
,[
,]
and characteru
.Steps to reproduce
folder_name="[u-a]" && mkdir -p "$folder_name" && touch "$folder_name/dummy" && vim "$folder_name/dummy"
Other folder names that trigger this error:
[Au-S]
,[Audio-Stuff]
.Full error message:
The text was updated successfully, but these errors were encountered: