nicwest / vim-camelsnek

Convert between camel and snek case (and kebab case)
The Unlicense
55 stars 3 forks source link

[FR] work in operator-pending mode #3

Open huyz opened 2 years ago

huyz commented 2 years ago

Just like https://github.com/christoomey/vim-titlecase/, it would be nice if there were some functions that wait for an operator such as motion or iw

zatchheems commented 1 year ago

@huyz I'm intrigued. what's the use case for operator-pending modes when the existing functions already operate on iw?

huyz commented 1 year ago

@zatchheems Consistency. When things are consistent, they become predictable. Otherwise, your finger memory will try it and it will fail. For example, maybe you want to apply the operation from the cursor position to the rest of the line.

zatchheems commented 1 year ago

hmm I see what you're saying, but there aren't currently any operators that work like that in this library. you can run camelsnek functions on blocks of text in visual mode though, like v$:Snek covers your last example.

are you asking for an implementation that adds operator mappings for specific keys for CamelB, Camel, Kebab, etc.?

huyz commented 1 year ago

I'm asking that there be functions like <Plug>Titlecase for each of the functions. Check out: https://github.com/christoomey/vim-titlecase/blob/master/plugin/titlecase.vim

zatchheems commented 1 year ago

ok, so that is what you're asking!

Consistency. When things are consistent, they become predictable. Otherwise, your finger memory will try it and it will fail.

are you proposing gz as a prefix for these new bindings?

I'm envisioning something like gzc for camel, gzb for camelback, gzs for snake, gzS for screaming snake, etc. because I could actually get a lot of use out of that. not sure if vim-titlecase eats up the initial gz though so both libraries might not be able to work together, and I'm not sure about keymapping etiquette WRT making sure libraries don't step on each-other's toes.

FWIW I have already implemented title and space case locally and am planning on contributing that to this library, just an interesting coincidence that you're showing this titlecase repo as an example. 🙂

nicwest commented 1 year ago

Sorry team, I totally missed this. is this still something that is of interest? This behaviour I believe is already available in tpope's vim-abolish: https://github.com/tpope/vim-abolish/blob/master/doc/abolish.txt#L146

huyz commented 8 months ago

vim-abolish only does a single word under the cursor; it doesn't allow for arbitrary operators You can't do something like: "snake-rest from here to the end of the line", for example.

I'm still interested. But it's not super important. So you're welcome to close it.