To be fair, you are missing a lot when ignoring text objects. Stuff like cib to delete what was in the next pair of brackets, go into insert mode and lets you type a replacement. Afterwards you can type . to repeat.
Note that you probably have to set paste mode, otherwise vim will likely try to format your pasted text and possible screw it up. You could do this with :set paste and :set nopaste, but more ideally you should make a shortcut for this. I use this in my .vimrc:
map <leader>pp :setlocal paste!<cr>
This lets you type <leader>pp to toggle paste mode. IIRC, <leader> is backslash by default, but that's a pain in the ass to type, so most people change it to , (comma) with:
It's not so much that Vi is so hard, but rather that with a modern text editor, most of the shortcuts are standard to the rest of the computing world and so you don't have to memorize anything. So Vi isn't hard, but everything else is so easy.
Two other useful things that vim users should know (because while the stuff you listed are the essentials, they don't really do anything that you can't do in virtually every editor):
Macros: hit q<letter> to start recording and save the macro into <letter> (this lets you record multiple macros). Do whatever actions you want, then hit q to stop recording. Now whenever you type @<letter>, you'll perform the recorded actions. If you specify a number before @<letter>, you'll perform the macro that many times.
Incredibly useful for avoiding repetitive commands. Macros can easily be the #1 time saver, since repetitive commands are a strong thing to stamp out.
ci<symbol> to change within some kind of enclosing symbol ({, [, ", etc). For example, if our text is:
<someXml attribute="value" />
Then inside of the double quotes, we could type ci" and it'll change the text to
<someXml attribute="" />
And put the cursor in insert mode after the starting double quote. Similarly, typing ci< will change the text to
<>
And put the cursor after the starting angle bracket.
I use a vim plugin for my IDE and use all the above commands above, it's great!
The one command I probably use the most is D. It cuts everything from the cursor to the end of the line. I can't remember if it puts you in insert mode, but you can always follow up with an A to put you in insert mode at the end of the line.
45
u/Neekoy Apr 20 '15 edited Sep 08 '26
Marvelous coordinated pause smile cough blanket
This post was anonymized with Redact