I used Vim for 2 weeks and here’s what happened.

Vignesh
4 min readJul 3, 2021

--

There are a lot of code editors out there… from a basic NANO to Visual Studio Code. Some have a modern pleasing GUI while others are built for simplicity. I used VS code a lot of time since it has some cool features such as the Integrated Terminal, Various syntax autocomplete extensions, and some really cool themes. But, recently I heard a lot about Vim that most of the advanced developers use Vim. So I wished to figure out what makes Vim so appealing to them and decided to give it a try.

Logo of the VIM text editor

So, what is Vim?

Vim is a command-line text editor which mainly focuses on mouseless code editing. Navigating the entire code, giving commands is done by keyboard shortcuts. Vim is based on a command-line text editor called Vi, which was originally designed as a part of the UNIX Operating System. Vim stands for (Vi-Improved) as it adds a few more functionality to the original Vi. Vim was first released in the year 1991.

Why advanced developers love Vim?

Vim is so popular among experienced professionals. The main reason for this is its usability. A programmer who works on thousands of lines of code has to take mouse a lot of times for various reasons. This greatly decreases the overall productivity of a programmer. Vim can be completely controlled using the keyboard and hence developers can have improved productivity since their hands are glued to the keyboard. This is the reason why programmers love Vim.

My experience with Vim

Out of this curiosity, I installed Vim on my Linux machine. At first glance, it looked pretty simple and boring, to be honest. I couldn’t navigate or edit the code properly. It was so frustrating to level, where I was about to give up trying Vim. But after continuous usage for around 2 weeks, I feel it comfortable even than my previous Visual Studio Code, mainly for one particular reason which is “Zero dependence on Mouse or Trackpad”. This also greatly improved my coding speed and also greatly decreased the time which I take for editing lines in code. This is how my Vim environment looks.

My coding setup with Vim

Looks so simple, right. Well, actually it is a lot better. I use Vim as an editor to edit the file main. cpp by looking at the reference file main. c where the third terminal is used for executing Makefile for compilation. I can cycle through my terminals using Super+Arrow Keys. So now, I can edit, save, refer to other code and compile, all with the keyboard, without having to take my hand away from the keyboard towards the trackpad or mouse. After 2 weeks of trying Vim, I got used to it and it feels better than my old coding setup.

Things to know about Vim:

Normal mode:

When you open a file with Vim, the default mode is the normal mode. The normal mode is used for inserting Vim commands. One can verify if Vim is present in normal mode is by noticing if no specific mode is shown in the bottom left corner of the terminal.

Vim in Normal mode

Insertion Mode:

The insertion mode is used to type the code in the text editor. Insertion mode can be identified by noticing the — INSERT — getting visible on the bottom right corner of the terminal.

Vim in Insert mode

Essential Vim Shortcuts to remember

While normal mode is active, press “i to switch to insert mode.

During normal mode is active, press “Esc” to switch to command mode.

To copy a line, when normal mode is active, press “yy”. (called yanking)

To paste the line, when normal mode is active, press “p”.

To delete a line, when normal mode is active, press “dd”.

Various normal mode commands:

  1. :w” - To save the edited code.
  2. :q” - To quit Vim
  3. :q!” - To quit vim by discarding any changes made to the code.
  4. h”- Move the cursor left
  5. j”- Move the cursor down
  6. k”- Move the cursor up
  7. l”- Move the cursor right
  8. :ter”- Open a terminal.

The above-mentioned commands and instructions are useful to start with Vim. However, there are so many commands which require a steep learning curve, but the usability improves as we learn more commands. This was an amazing experience for me, honestly. Thank you for reading my article.

--

--

Vignesh
Vignesh

Written by Vignesh

AI Enthusiast | Software Developer | Python | Linux | TensorFlow | YouTuber | Open Source | Electronics Undergrad | Tech Blogger

Responses (19)