Komodo / KomodoEdit

Komodo Edit is a fast and free multi-language code editor. Written in JS, Python, C++ and based on the Mozilla platform.
http://www.komodoide.com/komodo-edit
Other
2.15k stars 300 forks source link

Implement more case switching commands in Vi key binding #1712

Open blfgomes opened 8 years ago

blfgomes commented 8 years ago

Short Summary

{Visual}U/u, gU{motion} and gu{motion} are the ones that I use regularly in Vim and it would be nice to have them implemented in Komodo.

mitchell-as commented 8 years ago

Thanks for the suggestion. I'll tentatively file this for 10.1.

mitchell-as commented 8 years ago

I've spent some time looking into this and concluded this would not at all be easy with our current Vi implementation. (Perhaps this is because the requested commands are not in Vi, while our implementation appears to be centered around Vi, not Vim.) The workaround for at least {Visual}U/u is to use ~ (swap case).

Developer notes:

  1. The way our key bindings are defined, u maps to "Undo", and there is no way to apply another meaning exclusively to visual mode. Attempting to define v u ends up overwriting v as an entry into Visual mode.
  2. There is no way to create something like gU{motion} without mapping key bindings for every motion (e.g. binding vim_cmd_upperCase_right g U l, binding vim_cmd_upperCase_wordRight g U w, etc.). Ideally we would create a way to wrap every motion in one function. For now, the user can create userscripts and bind them to the appropriate keys.

TODO: figure out if we're targeting Vi keys only or both Vi and Vim keys.

Naatan commented 8 years ago

@twhiteman could you share any insights? iirc this was your baby, and you still use it :)

twhiteman commented 8 years ago

For gU/u I would probably create a keybinding for those, that put the vi keybinding controller into a special 'uppercase/lowercase' operation mode (similar to how the delete operation works with a motion, e.g. 'dw' keybind).

It looks like most of the g* keybindings could be done as a separate keybinds (there a lot of g* keybinds that do various and seemingly unrelated things :)

For the visual mode case, one could change the vim controller lookup table, so that "cmd_vim_undo" maps to a custom function which first checks if the mode is visual mode and does the uppercase/lowercase, else does the regular cmd_undo operation.

tonyattwood commented 8 years ago

Hi!

Look at that stuff, I like it so much, I guess you're gonna like it too. Look at it http://tryvospunte.failedchartpatterns.com/e4hdhlf

Best regards, tony.attwood