flit.nvim icon indicating copy to clipboard operation
flit.nvim copied to clipboard

Override to avoid using smartcase

Open AlexSWall opened this issue 2 years ago • 3 comments

I like using smartcase for standard searching but am not keen on it for my f (etc.) behaviour, so would like to avoid this. I have ignorecase = false for leap, but I'm still getting the behaviour of ff moving me to the next F.

Is there a way to override this or change this behaviour?

If not, I'm not against submitting a PR to add this functionality if you can point me to where it's occurring in the code and if it's not too complex; I couldn't see it.

AlexSWall avatar Dec 30 '22 14:12 AlexSWall

I have ignorecase = false for leap

Flit uses Leap's search function (get-match-positions), but feeds it with its own pattern, so Leap's setting is irrelevant here. (The option name is case_sensitive btw.)

Replace '\\V' with '\\V\\C' here, to force case sensitivity: https://github.com/ggandor/flit.nvim/blob/be110f9814a45788d10537fd59b3c76d956bb7ad/lua/flit.lua#L52

If not, I'm not against submitting a PR to add this functionality

The problem is not the implementation, but we'd need to decide on the API then. (Just an ignorecase flag? One for forcing smartcase too? An additional one to follow vim.o.ignorecase|smartcase? There are many possible combinations.)

ggandor avatar Dec 30 '22 15:12 ggandor

Makes sense. Thanks for pointing me to the right place.

There could be two flags, one for ignorecase and one for smartcase, with true and false values setting the value as an override and nil defaulting to vim.opt values?

AlexSWall avatar Dec 30 '22 15:12 AlexSWall

@ggandor If you give the thumbs up on this API, I'm happy to look into throwing in a PR. I just want to avoid putting in the effort if you wouldn't be happy with the solution.

AlexSWall avatar Jan 04 '23 03:01 AlexSWall