Vim Essentials

 

Vim is a great text editor that’s available for all Linux systems.
It’s also available for Windows and Macs. Having worked on Vim, I would like to share what I have learned.

Vim users often don’t use arrow keys to move cursors. They often use keys in the home-row. To use Vim, one must know keys in Vim and there are a lot of them.

The basic movement keys in Vim are:

  • h: left
  • l: right
  • j: down
  • k: up

The movement keys are not really intuitive to me at first. After I have learned that it helps keep your hand in the home-row from a Vim article, I am convinced that it does help boost up your typing speed.

 

Other essential Movements are:

  • gg: top of the document
  • G: bottom of document or to line number if a number is placed in front of G
  • w: next word
  • e: end of word
  • 0: beginning of line
  • $: end of line
  • CTRL-D: Page down
  • CTRL-U: Page up
  • CTRL-E: Scroll down one line
  • CTRL-Y: Scroll up one line
  • ): Move to start of next sentence
  • (: Move to start of last sentence
  • }: Move to start of next paragraph (as delimited by a blank line)
  • {: Move to start of last paragraph (as delimited by a blank line)

 

There are six ways to get into Insertion from Normal mode, the mode when one first starts Vim and they are:

  • i: insert before cursor
  • I: insert before line
  • a: Append after cursor
  • A: Append After line
  • o: Open a new line AFTER current line
  • O: Open a new line BEFORE current line

 

There will be times where you need to replace or delete text you have just entered. Those keys are:

  • x: Delete the character to the right of the cursor
  • X: Delete the character to the left of the cursor
  • D: Delete to the end of the line
  • dd: Delete the current line
  • d: Delete the current line
  • r: Replace one character
  • R: Replace several characters

 

To undo, redo or repeat your key inputs, use:

  • u: Undo changes
  • Ctrl-r: Redo changes
  • .: repeat last change

 

In conclusion, Vim is vast these are few commands that can help you through editing text in Vim. Other advanced topics in Vim will be buffers/registers, windows, tabs, as well as running plugins by using plugin managers such as Vundle. Once installed, a Vim plugin can provide extra features by typing commands in Vim. For example “:NERDTree” can open a file tree which lets you browse through your directory. Plugins like Emmet lets you quickly edit and create HTML tags through the use of key combination, say, i.

Vim Essential