text-case.nvim
text-case.nvim copied to clipboard
[Feature Request] support for unicode letters
Current Behaviour
áaaa
üuuu
ñnnn
use gaa
on each line to capitalize the word results in:
Aaa
Uuu
Nnn
Requested Behaviour
Áaaa
Üuuu
Ñnnn
Since this plugin is not catering exclusively to programming text cases, it would be nice to support unicode letters.
gu
/gU
/~
in normal Vim are already able to convert the case of unicode letters. Maybe you can utilize those, or whatever function they are calling, to convert the case.
That's fair.. Not an expert on unicode. Is there some kind of pattern?
For example, to cover all the letters, the plugin compares if the char is greater or equals to a
and smaller or equals to z
.
local is_previous_lower = previous_code >= codes.a and previous_code <= codes.z
local is_previous_upper = previous_code >= codes.A and previous_code <= codes.Z
local is_current_lower = current_code >= codes.a and current_code <= codes.z
local is_current_upper = current_code >= codes.A and current_code <= codes.Z
To get the codes I'm using LUA string.byte()
.
If there is that kind of patterns, and some way to identify if they are upper or lower, I can solve this feature. What I don't want is to degrade performance adding each possible char to a table (dict or array)