DEV Community

Cover image for VIM is tough, or is it???
Viral Sangani
Viral Sangani

Posted on • Originally published at blog.viralsangani.me

VIM is tough, or is it???

This post was originally posted on - https://blog.viralsangani.me/posts/vim-is-tough-or-is-it/
You can read more blogs at - https://blog.viralsangani.me/

In the past, I am stuck with this idea of making more with less, in the context of refactoring the line of code in the most efficient way possible. Recently I am exploring the use of VIM to unleash unlimited power of a text editor. VIM enables me to achieve more with every keystroke and with every hour I invest in programming.

This is the 1st part of the five-part series on VIM.

Let's talk about VIM.

VIM is a text editor who has a keyboard-centric design, unlike other text editors. VIM promises ultimate productivity to those who dare to face its steep learning curve and survive till the end to tell the tale.

I have been learning VIM for the past 2 months. To be honest, it was tough for the first week, but if you make it through the first week, trust me it's worth it. My first encounter with VIM was a year ago, when I saw my brother typing a bunch of command in vim to do some editing in one line and then he played the recorded command 100 times, and BOOM, 100 lines of code were changed with just a keystroke. That was fascinating. Since then I tried to use VIM as my primary text editor, but just because of the steep learning curve, I always gave up. But a couple of months ago, I came up with this YouTube playlist by ThoughtBot. When I suggest someone to use VIM, their first question is CAN IT DO THIS.... And the answer is YES. Just go through this playlist and all your questions will be answered.

Till this time, I haven't used 50% of the functionalities VIM offers, or that know about. However, I never completely shifted to VIM, instead, I use VIM extension for popular text editors like VSCode or PyCharm, etc. This will give you the flavor of both. You have you VSCode shortcuts + the power of VIM at your fingertip. Although using VIM with other text editors is not as good as the real thing, but for beginners, this is the best bet to get used to VIM quickly.

Answering, what is VIM?

VI is the ancient text editor created in 1976. The main purpose of creating VI is to make a text editor that works perfectly on a terminal. Later came the VIM(Vi IMproved) which has support for both text and graphical interfaces. It comes as the improved version of VI which technically supports all the operating systems known to mankind.

Why VIM but?

You might be thinking why should I care about some ancient text editor in 2020? VIM is a text editor that provides a different method of writing code. If text editors are compared to planets, VS Code, Sublime, ATOM, Jetbrains, Eclipse all are on the same planet and VIM is a different galaxy. It provides a way to interact with your code as no other editors can.

Now you might be thinking, what is there for me in learning VIM? See, VIM removes the dependency of MOUSE. Yes no more using a mouse, if you choose to go with VIM. Using VIM will make you a code surgeon. A code surgeon who can make precise code insertion whenever and wherever they want. If you are using one of those text editors other than VIM, you will be using a mouse to navigate in the code. But with VIM you can navigate into your code and codebase with lightning speed just using your keyboard. You don't even have to move your hand from keyboard to mouse. This is what you get from learning VIM, the speed, and the power of changing whatever you want with just a couple of keystrokes.

What makes VIM such a great text editor?

There are this things called modes in VIM. There are primarily three modes in VIM, Normal Mode, Inset Mode, and Visual Mode. Each mode has it's own significance we will see in further posts. All the keystroke have different functionalities in every mode. For example, d key is used to delete and copy the text in Normal mode, were as if you are in Inset mode, d is just the letter d, which will be typed if you press d key. This helps VIM to provide more functionalities with limited numbers of keys.

VIM is extremely customizable. You can change your key binding However it suites you, and whatever works for you. There are no restrictions like many text editors where you can't help it. If you want to copy the selected text by just pressing c, instead of pressing two keys =>Ctrl+z, you can in vim, but it might be too hard or not possible in other text editors.

Why VIM is hard?

Let's goto a darker side of VIM, or at least what some people think.

Let's see the learning curve of VIM.

vim learning curve

Yes, VIM is consistently hard to learn, because learning never ends in VIM. Every day you google something about VIM, and you'll get some exciting new stuff related to VIM and it's plugins.

And then comes this,

Meme

But according to me, what makes VIM sooooo HARD is it's Horrible first impression.

So in the next few posts, I will try to make leaning VIM not that difficult and providing you basics and resources to learn advanced VIM.

Just a friendly advice, if you take the courage of learning VIM, don't stop in between, I know it will be painful at the start, but trust me there will come a day when you will be saving hours in a day just by using VIM.

Top comments (17)

Collapse
 
itsjzt profile image
Saurabh Sharma

Vim is one if those: good to know things, even if don't you use it as a daily driver.

It will help you one day.

Collapse
 
fref profile image
Fredrik Fall

one day you will login to a server over ssh and need to edit a text file... VIM!

Collapse
 
viralsangani profile image
Viral Sangani

I still remember my first time with vim. Opened vim and didn't know how to close it, so I close the terminal.😅

Thread Thread
 
j_mplourde profile image
Jean-Michel Plourde

There's a reason why this question on stackoverflow is so popular

Collapse
 
metalmikester profile image
Michel Renaud

Yeah. I know just enough about it to make minor edits, save and quit. :) Some 25 years ago a friend of mine was using Vim and the speed at which he got things done was incredible. I never had the patience to sit down and really learn it.

Collapse
 
joaomcteixeira profile image
João M.C. Teixeira

One day you will edit a file that lives remotly directly through your local vim :-)

Collapse
 
viralsangani profile image
Viral Sangani

True!

Collapse
 
habereder profile image
Raphael Habereder • Edited

:%s/great/awesome/g

vim is awesome!

People that call vim bad should use vi first. They will appreciate vim a lot more then.

Collapse
 
viralsangani profile image
Viral Sangani

If they use vi first, then I guess they will never use vi or vim.😂

Collapse
 
habereder profile image
Raphael Habereder

Which would be perfectly reasonable and understandable :D

Collapse
 
alainvanhout profile image
Alain Van Hout

Vim is indeed a very powerful tool, though I'm always amazed how many people implicitly equate 'programming' with 'typing', in the same way that you'd equate the job of a manager with 'sitting in meeting rooms and writing emails'.

If typing is your bottleneck, rather than thinking, then you should always give it some more thought before you start typing 😁😋.

Collapse
 
emtes profile image
Enmanuel de la Nuez

Do I need to be able to touch type?

Collapse
 
viralsangani profile image
Viral Sangani

Not necessary, as a beginner it takes time, but once you have given enough time, the key binding will automatically come in your mind. It just needs practice.

Collapse
 
5422m4n profile image
Sven Kanoldt

You should try out the vim game a lot of fun and you'll learn it quickly..

Collapse
 
viralsangani profile image
Viral Sangani

That's a good place to begin.

Collapse
 
omarkhatib profile image
Omar

Best thing about vim it's learning curve , It's reward you for lifetime it's the kind of editor that will never die .
And with years u will become like hackers in the movie . Type so fast.

Collapse
 
viralsangani profile image
Viral Sangani

That's one of the motivation, do somthing that looks cool and not everyone can do it.🤯