How to install plugins in Vim

Plugins Vim for Frontend

Basically we have two options to install plugins in Vim :     Move the plugin files to specific folders ;    Using Pathogen.vim . Move the plugin files to specific folders As has become a custom create remote repositories for plugins Vim on GitHub if you choose to move the plugin files , consider that it will be very laborious update your plugins . For each plugin to install or update , you will need to clone the repository and then move the plugin files , as shown below: – .vim /- – – Doc / pluginTeste.txt- – – Plugin / pluginTeste.vim




Using Pathogen.vim The second option is a plugin Vim , the Pathogen.vim . It was created to solve the problem of installing and updating plugins by removing the need to move the plugin files to their respective folders . So you just need to clone the plugin to install , and update just a pull inside the plugin folder. The only rule that you must respect , is that all your plugins must be copied in the following folder : – .vim /- – – Bundle /- – – – – – PluginTeste Now we will hold the two installation options mentioned above in practice. We will run the first option Installing Pathogen.vim and following Install Emmet.vim using Pathogen.vim .

Installing Pathogen.vim To install Pathogen.vim , just run the following command in the terminal :     mkdir -p ~ / .vim / autoload ~ / .vim / bundle ; \    curl -Sso ~ / .vim / autoload / pathogen.vim https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim This command creates two folders ( autoload and bundle ) within the .vim folder (if .vim folder does not exist it is created ) , from within the folder ~ / .vim / autoload and download the file via pathogen.vim curl the remote repository on GitHub . Note . If you are using Windows replace the above command the occurrence ~ / .vim by ~ \ vimfiles . Now we have to add the following line in ~ / .vimrc :

execute pathogen#infect()

With this line added in ~ / .vimrc the Pathogen.vim manipulates in real time the path of the plugins that you add to Vim . Now we need to test whether the Pathogen.vim is working , so let’s install the plugin Emmet.vim within the architecture of Pathogen.vim folder.Install Emmet.vim using Pathogen.vim To install the plugin using the Emmet.vim Pathogen.vim folder architecture , just run the following command :     cd ~ / .vim / bundle ; \    git clone https://github.com/mattn/emmet-vim.git The above command enters the folder ~ / .vim / bundle and clone the remote repository Emmet.vim plugin hosted on GitHub . The Emmet.vim plugin is already installed , upgrade to run the following command :

cd ~/.vim/bundle/emmet-vim; \    git pull

The above command enters the Emmet.vim plugin folder and performs a pull on the remote repository. Finally , we need to test the Emmet.vim . If it works correctly it means that the Pathogen.vim did his part too.Using the plugin Emmet.vim Inside the terminal , run the following command :     came indexTeste.html This command will open the Vim text editor with a blank file if there indexTeste.html the file in the folder you are . Follow the three steps below to see if the plugin is working properly:     Step 1 – Press the i key ( you are in the INSERT mode Vim) ;    Step 2 – Write the following text in the file , html : 5;    Step 3 – With the cursor in front of the 5 , press the CTR key and Y together ( CTR + Y ) and then the key ( can not take much to push the button, ) . If at the end of the three steps above, you see the following HTML content below , the two plugins are installed correctly.

1.  <!DOCTYPE html>2.  <html lang=”en”>3.  <head>4.       <meta charset=”UTF-8″>5.       <title></title>6.  </head>7.  <body>8.   9.  </body>10.</html>

Congratulations , I hope this post has helped you ! Any questions or suggestions , just write a comment .




LEAVE A REPLY

Please enter your comment!
Please enter your name here