Why programmers should try Vim editor.

Devin Rathnayake
4 min readAug 29, 2021

In this article, I’m going to talk about why I’m switching Vim as my text editor from now on. And benefits, drawbacks. Vim is an interesting tool to learn and it’s not that difficult, only needs practice like the rest of others. Vim is going to save pretty much your coding time in the future. Vim gives you an actual feeling of the programmer since it can do codings with minimum use of mouse movements.

What is Vim

Vim is a command-line text editor which is released in 1991 by Bram Moolenaar. It looks like coding in the terminal. we can open any type of file and edit those. Vim is giving easy navigation through the code. It actually saves time and increasing efficiency.

For eg: copy/paste keys are Ctrl + c/ ctrl + v but using Vim only needs y and p keys for copy and paste.

Vim is pre-installed in macOS and Linux-based OS Windows users have to download manually.

In the beginning stage, I suggest you don’t use Vim from the terminal. Install Vim extension to your main IDE (eg: VS code, WebStorm …). Then you will not be stuck in the Vim at the beginning.

VIM extention for VSCode

VIM has 4 mods

  • Normal
  • Insert
  • Visual

Normal

normal is a mode where we have a thick cursor pointer in the editor. In this, we can do text manipulation activities by using the only keyboard. Below I list down example keys that I have usually used.

Text navigation

h — move cursor left
j — move cursor down
k — move cursor up
l — move cursor right

w — jump forwards to the start of a word

W — jump forwards to the start of a word (words can contain punctuation)

b — jump backwards to the start of a word
B — jump backwards to the start of a word (words can contain punctuation)
0 — jump to the start of the line

gg — go to the first line of the document
G — go to the last line of the document

u — undo

yy — yank (copy) a line

p — put (paste) the clipboard after cursor
P — put (paste) before cursor
dd — delete (cut) a line

Insert

To switch normal mode from insert mode have to press i. After that curser will be thick to the thin blinking line. It is the visual format that can be used for mod identification. Insert mode can be recalled as writing mod where we can write the code. To exit from insert mode to normal mode, have to press ESC

i — insert before the cursor
I — insert at the beginning of the line
a — insert (append) after the cursor
A — insert (append) at the end of the line
o — append (open) a new line below the current line
O — append (open) a new line above the current line

Visual

After you pressed v you will be entered into the visual mod. I’m not sure why they called visual mod. Here you are able to select multiple lines in the editor and perform editing tasks to the text. To exit from visual mod to normal mod, have to press ESC

v — start visual mode, mark lines, then perform an operation (such as d-delete)
V — start linewise visual mode

My Drawbacks

I have to say I’m an absolute beginner of the Vim. Here I showed key bindings are which I have used in my coding. Please note there is plenty of key binding are available in the Vim. The learning time of the Vim is much longer which is a major drawback I have noticed. All key bindings you have to memorized to use it.

But using everyday Vim those key bindings will be familiar to you. Don’t think all of the key bindings Vim has. Start to use several keys. Later you will know considerably many key bindings with your experience.

--

--

Devin Rathnayake

IT undergraduate, IT person. Love to share knowledge with others. Feel free to contact me at anytime.