If you go on any corner of the progrmaming internet, it shouldn't take long because you're rudely interrupted as you round the corner by a joke about quitting vim. A new user might reasonably think if quitting is so hard, imagine the rest of it.

Well, you don't have to know a lot about vim for it to be a really useful tool. It's a great way to have a consistent editing experience across servers, IDEs, or even Chrome. With very basic knowledge it also begins to become something that'll make a lot of your work faster, and easier.

So, this aims to provide the precise minumum that you can know about vim and still find it useful. This means, i'll leave out things like visual mode, macros, and plugins - because fundamentally, you don't have to know a lot about them for vim to be useful.

Step 1 - You edit, or give actions

When programming, you'll almost definitely spend less time typing in characters compared to time doing literally anything else. So thus, when you are attempting to type in letters ensure you're in INSERT mode. You get into insert mode by typing i. If i just appeared in your document, congrats, you were already in INSERT mode.

Vim doesn't make it subtle if you're in INSERT mode. It's down the bottom

While here, do all the typing of characters that you need. When you're done. Exit INSERT mode with the escape key.

In essence, to make Vim useful, get in the habit of being in insert mode when you actually want to add characters to your screen. The moment you're no longer doing that. Press escape.

Step 2 - Move around

When you're not in insert mode, you can give commands. You might want to use them to move. The most basic forms of movement is up, down, left right. Everything else is optional. It's just HJKL = Left, Up, Down, Right.

Step 3 - Save and exit

Because you're not inserting text, you're of course in COMMAND mode. In this mode press Shift + ; to begin your command. All you have to know to be useful is w, q, and !.

:w<Enter> is write

:wq<Enter> is write and quit

:q<Enter> is quit

:q!<Enter> is quit!!! I really mean it, don't ask about unsaved changes

At this point, Vim is already useful

Congrats. You now know enough to have a consistent editor no matter what platform you're on.

From here, every addition is a choice and thus it's worth avoiding beating youself up about the fact that you don't know every keystroke on that vim cheatsheet you saw. Instead celebrate the utility you already have.

Choices I made

In the 10 years i've used vim, here's a list of things i've never really gotten into

  • A super customised ~/.vimrc file. The vast majority of the time, i don't even use a custom one though if you want one, just Google.
  • Plugins
  • Having multiple buffers open at the same time
  • Trying to make Vim an IDE
  • Macros
  • File management within Vim itself

Still, any time that I install an IDE the first thing i do is install vim, i use it daily at least on my local media server, raspberry pi, or work laptop.

Here's the things i decided to learn about on top of it

Fast Movement

  • gg top of File
  • G bottom of file
  • :12 go to line 12
  • 23j go down 23 times. (Can do this sort of things with tonnes of commands)
  • /searchString find "searchString" in your doc
  • * find the next time the word under the cursor is mentioned
  • n give me the next one
  • p previous one thanks
  • 0 start of line

Fast edits

  • dd delete line
  • C change from my cursor to the end of line
  • ciw Change in word (delete the word and start INSERT mode)
  • di{ delete all text within braces
  • ci) delete all text within parens and start INSERT mode
  • A append to the end of the line

This works for me. It only scratches the surface of what it can do. But that's ok. Instead of trying to be a master, try lean in to the fact that you don't have to know a lot about something for it to be useful.