Saturday, October 27, 2012

How to install vim plugins

I have long been an Emacs user, but find myself using Vim more frequently when editing from the command line. One day I went to edit a Clojure source file and found that indentation rules and syntax highlighting were not installed. Using the VimClojure plugin I am now able to edit Clojure files properly, but it was a pain for me (a noob when it comes to vim) to get it working. Here is how it is done:

Command Line

Download the file

Move the file to /usr/share/vim/vimfiles/
sudo mv /usr/share/vim/vimfiles/

Extract the file

sudo unzip

For tar.gz:
sudo tar -xvwzf plugin.tar.gz

If this ends up creating a directory instead of extracting the files, do the following steps.

cd into the folder
cd created-folder

Move its contents
sudo mv ./ ..

You can now start using the plugin. But beware, for many plugins you are also required to edit the vim configuration file at /etc/vim/vimconfig

My Clojure plugin needed syntax highlighting and and filetype plugin indent on. Your README file (if there is one) should tell you what to do.


 Download the plugin
  Run a file manager as root.

 Copy the zip file from wherever you downloaded it.
Plop it into /usr/share/vim/vimfiles/ and extract it.
If the README file specifies it, edit the vimrc file found in /etc/vim/vimrc/

This is usually just a matter of uncommenting a few lines. I had to uncomment syntax highlighting and file auto indent.

No comments:

Post a Comment