We have (?i) to start case-insensitive matching, (?I) (the default) to start case-sensitive matching, but Kakoune doesn't support Vim's smartcase behavior (case-insensitive until you add a capital letter). It would be nice if there was another modifier to enable smartcase behavior.
ripgrep also supports a --smart-case flag, which I think describes the behavior nicely:
-S, --smart-case
Searches case insensitively if the pattern is all lowercase. Search case sensitively
otherwise.
A pattern is considered all lowercase if both of the following rules hold:
First, the pattern contains at least one literal character. For example, a\w contains a
literal (a) but just \w does not.
Second, of the literals in the pattern, none of them are considered to be uppercase
according to Unicode. For example, foo\pL has no uppercase literals but Foo\pL does.
This overrides the -s/--case-sensitive and -i/--ignore-case flags.
Right now I have the following mappings in my config:
map global "normal" "/" "/(?i)"
map global "normal" "?" "?(?i)"
map global "normal" "<a-/>" "<a-/>(?i)"
map global "normal" "<a-?>" "<a-?>(?i)"
I'd prefer if my search mappings were case-aware, changing behavior based on the contents of my regex, rather than needing a separate set of mappings for each behavior.
Feature
We have
(?i)
to start case-insensitive matching,(?I)
(the default) to start case-sensitive matching, but Kakoune doesn't support Vim'ssmartcase
behavior (case-insensitive until you add a capital letter). It would be nice if there was another modifier to enablesmartcase
behavior.ripgrep
also supports a--smart-case
flag, which I think describes the behavior nicely:Related issues:
*
, not/
?
<a-/>
<a-?>
)Usecase
Right now I have the following mappings in my config:
I'd prefer if my search mappings were case-aware, changing behavior based on the contents of my regex, rather than needing a separate set of mappings for each behavior.