3 ms·
If someone's editor has got a convenient way to capitalize parts after they've been written, I'd be interested in knowing how it works. You can invert case wit
by clarry 13y ago
If someone's editor has got a convenient way to capitalize parts after they've been written, I'd be interested in knowing how it works. You can invert case with ~ in vi, but it's not so great for #defines and such (you capitalize every letter in these, and ~ works on a letter at a time).
- rbonvall 13y agoVim provides operators for changing case: gu for lower case, gU for upper case and g~ for swapping case. For example, gUaw changes the current word to upper case. guu changes the whole current line to lower case. In visual mode, you can use just u and U. Bonus useless tip: g? encodes and decodes rot13.
- clarry 13y agoThanks, I guess that explains why gg is needed to go to top. In my editor it's just g. Maybe I'll come up with something clever.
- albedoa 13y agoTilde can be used as an operator in Vim, so typing ~w will change the case from the cursor to the end of the (w)ord :)
- rm445 13y agoI'm no Vim wizard, but don't most of the commands work like that? You could type e.g. 6~ to change the case of 6 letters at once.