johmsalas / text-case.nvim

An all in one plugin for converting text case in Neovim
425 stars 17 forks source link

Some hints #143

Closed gregorias closed 8 months ago

gregorias commented 8 months ago

Hi, I’m creating my own utilities for case conversion (I need to support Unicode) and I noticed a few things that you could consider:

  1. Neovim has vim.fn.tolower ([link](https://neovim.io/doc/user/builtin.html#tolower()) that you can use instead here. I've tried it and it seems to support non-ASCII transformations.
  2. has_lower (link) doesn't support Unicode characters. I’m considering writing my own that uses tolower and then compares the two characters for equality.
  3. There’s [charclass](https://neovim.io/doc/user/builtin.html#charclass()) that you can use to check if a character is punctuation or not.
  4. There’s [charidx](https://neovim.io/doc/user/builtin.html#charidx()) that you can use to split a string into a character list, e.g., https://github.com/johmsalas/text-case.nvim/blob/d6f121ec471118afb4fc7ed8cafb08eef3e9b307/lua/textcase/conversions/stringcase.lua#L60-L66. Possibly it’s a more reliable way of doing it.

Keep up on the good work.

johmsalas commented 8 months ago

Hi @gregorias, appreciate the hints

Unicode support has been working without issues (or may not be enough users to report them) and it has integration testing coverage. We're going to consider your suggestions if any bug comes up.

Feel free to report any bug or more hints, tbh I didn't know about the things you mentioned