nicwest/vim-camelsnek

[FR] work in operator-pending mode

huyz opened this issue ยท 7 comments

huyz commented

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

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

huyz commented

@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.

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

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

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. ๐Ÿ™‚

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

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.