wiki/notebook/editor.vim.org
Gabriel Arazas b088086b06 Merge evergreen notes into the notebook
Now, it's all under the notebook umbrella. Seems to be appropriate as it
is just my notes after all.

I also updated some notes from there. I didn't keep track of what it is
this time. Something about more learning notes extracted from my
"Learning how to learn" course notes and then some. Lack of time and
hurriness just makes it difficult to track but it should be under
version control already.
2021-07-21 16:28:07 +08:00

2.1 KiB

Vim

Every sysadmin's favorite default text editor. Is being familiar to Vim a path to productivity? No. But being good at it can make for a difference in the day-to-day life of a sysadmin for there are advanced capabilities of this editor.

The keybindings of Vim

One of the things that make Vim popular is the keybindings.

Keybinding Description
[m Go to the previous method.
g~w Toggle letter casing.
2guW Convert two words into lowercase.
10d) Delete 10 sentences.
39zz Place the cursor in the middle in line 39.
3d10w Delete 10 words and repeat 3 times.

Most of the time, Vim keybindings is made of mainly two things:

  • The operators denoting an action.
  • The motions describing the scope of the action.

There's a certain pattern to it when you use it, too.

[count][operator][motion]

Tips and tricks

  • :h is the help system of Vim. It contains all of the documentation of the editor and the installed plugins. I recommend to start with the default help page (e.g., :h).

    • You can get the meaning of the keybinding with the help section — e.g., :h gg, :h G.
  • Vim has fine-grained control motions.

    • ( and ) for sentences.
    • { and } for paragraphs.
    • [ and ] for sections.
  • There are many advanced navigation features in Vim.

    • gf will go to the file at point.
    • K goes to the definition of the keyword at point.
    • Ctrl+O will jump back at a previous jump point.
    • gd go the local definition of the keyword at point.
    • H, M, and L places the cursor in higher, middle, and lower part in the current screen, respectively.
    • zt, zz, and zb displays the current line in the top, middle, and bottom part of the screen, respectively.