Why people run away from vim

  • When you open VIM for the first time then you will see a blank screen without any menu etc.
  • There is no sidebar showing project structure.
  • If you open any file let say JavaScript or CSS or html then there is no syntax highlighting.
  • If you want to edit multiple files then you first open the first file edit it close it and then again open the second file edit it close it.
  • There is no color scheme and everything looks like black and white
  • Also no information like
    • total lines in the document
    • Where the cursor is currently

All these things scare people and they move to either sublime, Atom or JetBrains etc.

But don't fear Plugin Managers are there.

Yes you heard it right there are number of Plugin Managers to help you out and customize VIM for your own development needs.

What does a Plugin Manager do

As the name suggest you can plug new things to your vim and make it awesome. Plug Manager helps us to manage the plugins that you have installed in your VIM for your development needs.

Some of the Plugin Manager used by the developer community are

  1. Pathogen
  2. Vim-Plug
  3. Vundle

We will be using Vim-Plug as our own plugin manager

Installation Vim-Plug


    curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
        https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

What happens when you run above command

When you run above command then curl visits the url https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim and download this file in your local machine at the path ~/.vim/autoload/

This is all what vim does to install the Vim-Plug plugin manager.

What happens when you run the command vim

This is the most important concept that needs to be understood.

When you run vim command in our terminal then it reads the file .vimrc present in your home folder and configures vim according to the settings present in the .vimrc folder

To find your .vimrc file you need to go to your home directory


    cd ~

It may happen that if you are using vim for the first time then .vimrc file may not be present. If there is no .vimrc file then just create your own


    touch ~/.vimrc 

All your settings related to vim will go inside your .vimrc file

Activating plugin manager

As you have installed Vim-Plug but it will not show any changes in your vim because the necessary settings for Vim-Plug has not been done in your .vimrc file

To configure your vim with Vim-Plug you need to open the .vimrc file


    vim ~/.vimrc

You need to put these lines to the .vimrc file


    call plug#begin()

    call plug#end()

All the list of your plugins will go inside the blank space present in between call plug#begin() and call plug#end.

so the next time you will open your vim then it will try to call the plugin manager Vim-Plug and inject necessary settings into your vim.

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x