Search This Blog

Wednesday 25 March 2015

Pathogen plugin manager for VIM in Ubuntu 14.04

Pathogen plug-in manager for VIM in Ubuntu 14.04

VIM is a powerful text editor which is minimalistic and simple, it is mostly command line and there is even G VIM which is a GUI version of vim, The difference is that when you open Vim it opens in command-line and G Vim opens in GUI that is graphical version.Installing Vim in Ubuntu is simple:
  
~$ sudo apt-get install vim

This installs vim in your machine and now you are ready to go. You can learn Vi tutorials.

Pathogen
   Pathogen is the plug-in manager for Vim editor as there are lots of plugins
that make the editing easy and making text look colorful, the plug-ins like template makes writing code easier. Installing Pathogen is a easy process just two lines of code makes it install. 

~$ mkdir -p ~/.vim/autoload ~/.vim/bundle;
~$ curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim 
 
If you don't have curl installed, use:

~$ sudo apt-get install curl
   



Then try the second line code again after curl is installed and then you need to create ~/.vimrc file for that type in below command in terminal.

~$ sudo gedit ~/.vimrc

After that gedit file opens with no data then just copy paste the below data into the file and save the file and quit.

 " contents of minimal .vimrc
execute pathogen#infect()
syntax on
filetype plugin indent on

And thats it the pathogen is installed or configured and now you can install plug-ins.

NERDTree

NERDTree is a plugin that is for file browsing with bookmarks. Installing pathogen is simple:

~$ cd ~/.vim/bundle
~$ git clone https://github.com/scrooloose/nerdtree.git

Thats it it installs NERDTree plugin is installed. you can open Vim and type 

:NERDTreeToggle  

to toggle the file browser open or closed. Use arrows to select files and press enter to open file in current tab. To open in a new tab, select the file and press t.

VIM template

VIM template is a plugin that provides templates for files like python,html and ruby.
 
~$ cd ~/.vim/bundle
~$git clone git://github.com/aperezdc/vim-template.git

Now,try:

$ vim test.py

this shows a standard template of python.
 
There are lots of Vim plug-ins and you can google them and to get around the Vim the best book is Byte of Vim by CH Swaroop and its free ebook you can download it and get around with commands.