-
Notifications
You must be signed in to change notification settings - Fork 320
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
Let wildcards without a period work. #369
Conversation
It's about several years since I last touched this function, so I'm a bit fuzzy on how strict we should be here. I just remember that the original intent was to be err on the conservative side. Some things I notice:
If your goal is to ignore files of the form if pattern.match(%r{\A\*\([^*/.]+)\z})
# *something (match file with suffix at any level)
'(\A|/)[^/]+' + Regexp.escape($~[1]) + '\z' (Typed in GitHub, so may be wrong.) |
Your are absolutely correct, I really just wanted to trap *something. I'll tighten it up and test it again. Thanks for your input. And thanks for the plugin. |
Stop regex including *./ characters. Anchor search for narrower results.
I just pushed a new commit that fixes the issues you brought up.
|
Thanks @twrecked. I think this is probably all right now. I'm going to merge it with this additional tweak on top: diff --git a/ruby/command-t/lib/command-t/vim.rb b/ruby/command-t/lib/command-t/vim.rb
index d8bcffe..f01bda4 100644
--- a/ruby/command-t/lib/command-t/vim.rb
+++ b/ruby/command-t/lib/command-t/vim.rb
@@ -81,7 +81,7 @@ def wildignore_to_regexp(str)
'\.' + Regexp.escape($~[1]) + '\z'
elsif pattern.match(%r{\A\*([^/*.][^/*]*)\z})
# *something (match file with extension without front dot at any level)
- '[^/]+' + Regexp.escape($~[1]) + '\z'
+ '(\A|/)' + Regexp.escape($~[1]) + '\z'
elsif pattern.match(%r{\A\*/([^/]+)/\*\z})
# */something/* (match directories at any level)
'(\A|/)' + Regexp.escape($~[1]) + '/.+' In part for consistency, but also because I think |
Ok, tested it a little bit more and what I said in the last comment isn't quite accurate — it needs to be something more like what I originally suggested (ie. |
This fix lets wildcards without a period - ie,
*~
, Vim's default back up extension - to be hidden from file lists.