Tutorials:Vim Pathogen

From Knowledge base
Jump to: navigation, search

Link vim and git plugins repositories.

I was looking hard a way to have an accessible and up-to-date plugins management for VIM.

After a while, I have found VIM Pathogen.

This module is a life-changer.

Let's start a reset of your vim config. First, move everything into a backup dir.

$ cd $HOME
$ mkdir vimbackup
$ mv .vimrc .gvimrc .vim vimbackup
$ mkdir .vim
$ touch .vimrc

Then setup a "pathogen" vim rc directory :

$ mkdir -p ~/.vim/autoload ~/.vim/bundle; \
$ curl -Sso ~/.vim/autoload/pathogen.vim \
    https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim

Now we create a minimal vimrc file :

$ mkdir ~/.vim/rc
$ cat <<EOF > ~/.vim/rc/vimrc
execute pathogen#infect()
syntax on
filetype plugin indent on
let mapleader = ","
EOF

And link it :

$ ln -s ~/.vim/rc/vimrc ~/.vimrc

Now everything placed into ~/.vim/bundle is automatically loaded by vim!

Let's move to a git repository, for easy maintenance.

$ cd ~/.vim
$ git init
$ cat <<EOF > .gitignore
*~
.netrwhist
EOF
$ git add .
$ git commit -m 'init pathogen vim repos'

Now the magic start. Let's add a plugins :

$ cd ~/.vim
$ git submodule add git://github.com/vim-scripts/taglist.vim.git bundle/taglist
$ git commit -m 'add taglist plugin'

Let see if it's work. Add a shortcut :

$ cd ~/.vim
$ cat <<EOF >> rc/vimrc
"TagShortCut
map <Leader>t :Tlist<CR>
EOF

Edit a file, and type : ,+t. , is the leader I have set previously. The command Tlist should be fire, and you should see the tag list appear.

All vim-script is clone to GitHub. So don't worry, just go to GitHub and try to find the module you want. You should always be able to clone it.

Here a list of plugins I like :



Share your opinion