command-t icon indicating copy to clipboard operation
command-t copied to clipboard

g:CommandTWildIgnore not working as expected

Open magus424 opened this issue 7 years ago • 6 comments

The code that handles g:CommandTWildIgnore appears to require specific syntax to ignore a directory, which does not match that of vim's wildignore handling.

In vim, adding something like phpunit/ to wildignore will result in that directory (in the current directory of time) disappearing from the available choices.

With Command-T's setting, it appears to only function correctly if I add */phpunit/*, which has a very different meaning from the other. Attempts to add phpunit/ or phpunit/* do not work, even though my root folder that Command-T searches has a phpunit directory (the one I'm attempting to filter out). I would not want to block every matching sub directory for this sort of match.

Another wildignore value that works in vim but does not work with Command-T is */templates/MASTER/*.php - I want to block all PHP files within that matching directory path, while allowing all non-PHP files in that directory path to come through.

magus424 avatar Sep 06 '17 03:09 magus424

So the point of g:CommandTWildIgnore is that you can use it to specify the pattern independently of Vim's own 'wildignore', so any discrepancies in the semantics can be worked around.

https://github.com/wincent/command-t/blob/7f21c5ea9eb5cdfba8e4429a4226fe282a32871a/doc/command-t.txt#L921

Full docs for the pattern syntax here:

https://github.com/wincent/command-t/blob/7f21c5ea9eb5cdfba8e4429a4226fe282a32871a/doc/command-t.txt#L1102-L1140

If you think you've found something inaccurately described there, I'd welcome a PR to fix up the docs (also if you think you can make the behavior converge that would be useful too).

wincent avatar Sep 06 '17 05:09 wincent

Right, but syntax that works in wildignore to block things from wildmenu, for example, does not work in g:CommandTWildIgnore, so the pattern syntax listed in the wildignore help is not very useful, as it doesn't work the same way :)

If you want to stop abiding by the wildignore syntax, I'd vote for allowing it to be regexp directly, but right now the conversion doesn't appear to be accurate.

With the discrepancies, it could lead to duplication between the two options, if an equivalent even exists. I was unable to find an equivalent to my example matches, for instance - if I'm just missing something, I'd be happy to alter them, but so far it seems like I simply cannot exclude certain things from Command-T, without being overly broad.

edit: I'll have to look at the conversion again and see if something can be improved; I would much rather that be fixed vs editing the docs to match the newer, more limited behavior.

magus424 avatar Sep 06 '17 06:09 magus424

I agree with @magus424 that command t should match the syntax of wildignore.

For example, I want to do something like:

set wildignore=lots_of_patterns
let g:CommandTWildIgnore = &wildignore
let g:EasyGrepFilesToExclude = &wildignore
" etc...

but right now I have to duplicate lots_of_patterns and put the */ before each one so it works with command t. Rather annoying...

dylan-chong avatar Oct 29 '17 09:10 dylan-chong

Am I correct in saying that the only difference between Vim's wild ignore the syntax and command t's syntax is that the commands T syntax requires a */ at the front of each path?

dylan-chong avatar Jun 05 '18 06:06 dylan-chong

Am I correct in saying that the only difference between Vim's wild ignore the syntax and command t's syntax is that the commands T syntax requires a */ at the front of each path?

Everything I know about the syntax is in the documentation that I referenced above.

wincent avatar Jun 07 '18 15:06 wincent

Am I correct in saying that the only difference between Vim's wild ignore the syntax and command t's syntax is that the commands T syntax requires a */ at the front of each path?

No, wildcards in the middle also don't work, like my */templates/MASTER/*.php example. Just haven't had time to go back and try and fix it :)

magus424 avatar Jun 07 '18 19:06 magus424

Given the big rewrite for v6.0.x, I'm closing all older issues as there is unlikely to be anything significant happening on the 5-x-devel branch from here on[^patches]. Feedback issue for 6.0.x is here:

  • https://github.com/wincent/command-t/issues/393

[^patches]: Patches and PRs would be welcome, but my personal efforts are going to be directed towards main.

wincent avatar Aug 26 '22 21:08 wincent