vim-lister
vim-lister copied to clipboard
Feature Request: smartcase option
How about an option to grep using smartcase by default, instead of case-sensitively?
Right now, prepending \C
whenever the searched expression does not contain an upper case letter is the only, inconvenient, workaround.
Hey there!
This might be a bit challenging. Internally, the :Xgrep
family of commands are using the comparison operators =~#
and !~#
to do the list grepping. These operators always act like 'ignorecase'
is off. I could (arguably should) change these to =~
and !~
to respect the 'ignorecase'
option. There seem to be no operators, however, that respect 'smartcase'
. Same goes for functions like match()
.
A workaround may be to implement a custom comparison function that duplicates the 'smartcase'
behaviour, but I hesitate to do so in case of various nuances that I may miss.
True, I also would say that to reproduce smart-case, one must
- stick to
=~#
and!~#
, - check if
&ignorecase
is set, if so prepend\c
to it, except if&smartcase
is set and the string contains an upper case character.
Better, use =~
and !~
, and prepend \C
to the string if &smartcase is set and the string contains an uppercase letter.