chrisbra / matchit

The matchit plugin from Vim
61 stars 9 forks source link

'smartcase' is respected when searching for matches #37

Closed dkearns closed 1 year ago

dkearns commented 1 year ago

Setting b:match_ignorecase is insufficient to allow case-ignored matching of words if smartcase is set and the b:match_words pattern contain uppercase characters.

I noticed this when configuring Matchit for Forth. The runtime files maintainer requested the words be specified in uppercase, as is the norm for that language, but the matching actually needs to be case insensitive.

So with the following Vim configuration if and then are not matched in the Forth example.

let b:match_words = '\<IF\>:\<THEN\>'
let b:match_ignorecase = 1
set smartcase
\ Forth
true if doit then

I was under the impression that smartcase was only applied to some interactive searches but that doesn't appear to be the case.

chrisbra commented 1 year ago

Hm, have you tried adding \c to the pattern?

chrisbra commented 1 year ago

interestingly, the help states exactly this:

https://vimhelp.org/options.txt.html#%27smartcase%27

Only used when the search pattern is typed

Not sure why it would come into effect here.

chrisbra commented 1 year ago

I also sent an update to Bram: https://github.com/vim/vim/pull/12611

dkearns commented 1 year ago

Thanks @chrisbra.