This year, I am going to explore and learn the basics of vim. Each day, I aim to learn a few vim commands and post them as a series of blog articles.

Day 1 – Installation, Navigation & How to quit vim

Installation

check if it is already installed? `vim –version` or install it using the following command if you are using ubuntu:

sudo apt install vim

How to quit?

  • q! – Quit without saving
  • w – Save Changes
  • wq – Save & Quit
  • ZZ – Faster Save & Quit

Modes

I’ve explored four modes so far:

  • Normal Mode
  • Insert Mode
  • Visual Mode
  • Ex Mode

Step 1: Get rid of Arrow Keys and Mouse

Stop using Arrow keys & mouse. In normal mode, navigate using the following:

  • h – left
  • j – down (imagine j is an arrow pointing downwards)
  • k – top
  • l – right

Step 1.5: More about Navigation

  • ^Y – Scroll Up a little bit.Ctrl + Y
  • ^E – Scroll Down a little bit. Ctrl + E
  • ^B – Scroll Up a screen. Ctrl + B
  • ^F – Scroll Down a screen. Ctrl + F

Step 1.8: A Final Touch

  • gg – Go to top of the file
  • H – move the cursor high i.e. top of the screen
  • M – move the cursor to the middle of the screen
  • L – move the cursor to the bottom of the screen
  • G – Go to the bottom of the file.

That’s it, for tonight. Let’s practice this for a day and put these commands in muscle memory!

Vim Resource


Continue to Day 2

1 comment

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.