vim introduction

You must have thought about what is VIM.

The real power of Vim comes when you know how to type without seeing a keyboard. You need not be an expert in typing but if you are a beginner in typing then it is high time to start learning Vim because learning Vim also improves your typing speed.

Introduction

Are you ready to leave your mouse and do all the text editing using the keyboard?

You will never need to spend money on a new mouse for text editing. You will see that learning keyboard shortcuts in one application will help you do the same thing in multiple applications.

Have you ever heard that a text editor works as if we are doing programming in a text editor? Vim is all about brain muscle power. Once you get it you will enjoy it.

Why do people fear using Vim?

I have seen people who make up their minds to learn Vim but after using it for some days they leave it and the best candidate for this example is myself.

Why I should learn so many keyboard shortcuts if the mouse is there to help me out?

People find it difficult to remember keyboard shortcuts for doing text editing tasks. They find the learning curve high for using VIM. I will accept that the learning curve for Vim is quite high which means that when you start to learn Vim then it feels difficult but as you proceed it becomes very easy.

I need to tell you that using a mouse is just like slow poison consumption which means you will not see the effects soon but in the long run, it will harm you very much.

My experience with Vim

I have tried learning vim for more than five times and then left it every single time.
I gathered the motivation to learn it again and this time I was successful and from then I have fallen in love with Vim. It helped me to improve my typing skills.

How do you generally do editing?

Writing some code

  • Suppose you are writing a function.
  • You start to write your function and proceed to complete the desired behavior.
  • then we compiled it and ran the program and some errors were thrown on the console.
  • so you move out your fingers from the keyboard. ( distraction )
  • then you hold your mouse to go to the desired position or move to that location using our arrow keys. ( distraction )
  • so in either case you move your hand from the keyboard, this causes distraction which in turn reduces efficiency and also causes pain in your hand due to frequent movement.
  • If you make an approximation of how many times you do the above process then it comes out to be more than a thousand times for an average developer.

Copy and Paste

  • If you want to copy any section or text.
  • so you move your fingers from the keyboard. ( distraction )
  • then you select that section using the mouse by left click and dragging the mouse to the end of the section. ( distraction )
  • then go to the place where you want to paste this right-click and then select paste.
  • In this whole process, we left the keyboard so many times and this reduced our efficiency.

Five things that motivate you to learn vim.

  • Learn In Steps: vim learning has the advantage of learning only those things that are needed for you. People often say that I have been using Vim for more than 10 years but still, I don’t know much about it.
  • Make vim how you want to see it: You have the power to convert your text editor in whatever way you like. You want to use it as a javascript development IDE(Integrated Development Environment) and then customize it in that way. If are you a Python developer then customize it in that way. vim has a very vast open-source community and everyday people are developing new plugins for vim. If you want your editor to behave in a particular way just use a plugin for that.
  • Production Environment Savior: Production environment means when your product is running live on a server and people are using it. Solving issues and errors in a production environment is a nightmare for developers. Your favorite IDE will not be there while solving errors in the production environment. Now, your only savior is VIM
  • The three Faces of Vim: when you use your favorite IDE you only need a single mode i.e. which is editing mode.

Dependency of Vim?

When vim is installed it creates two entities in your home folder

  • .vimrc — This is a file.
  • .vim — This is a folder.

To see these files follow

cd ~/
ls -la // a option is to show hidden files and folders

What is the .vim folder?

.vim folder is a hidden folder in your home directory. It contains all the external data that you add while configuring Vim according to your use. All the plugins that you add to your vim get downloaded here.

What is a .vimrc file?

When you start Vim then it reads the .vimrc file and converts itself into the way that the .vimrc file describes it to do. This is the configuration file of the vim where all the configuration related to vim exists

Comments in .vimrc file

Comments in Vim start with a double quote but it doesn’t close itself

"This is the way to comment in vim

Some basic vim configurations

There are some basic configurations that you need to add to work vim smoothly. Most of the configurations are understandable by reading it.

syntax on
filetype plugin indent on
set nocompatible
set backspace=2

Some basic commands

Movement commands :

h -- move one character left.
j -- move one row down.
k -- move one row up.
l -- move one character right.
gg -- move to the beginning of document
SHIFT + g -- move to the end of the document

Modes in vim

we will learn more about these modes in my next blog stay tuned.

Modes tell how a single text editor can behave differently on simple keyboard button pressing. There are three modes in Vim

  • Command mode
  • Insert Mode
  • Visual Mode

References

Read Next about Plugin Manager

Leave a Reply

Your email address will not be published. Required fields are marked *