Wikia

Vim Tips Wiki

Changes: How to mimic the vim 6.0 plugin feature with older versions

Edit

Back to page

(Uploaded by JohnBot from a locally edited file)
(Move categories to tip template)
 
Line 9: Line 9:
 
|version=5.7
 
|version=5.7
 
|rating=8/5
 
|rating=8/5
  +
|category1=Plugin
  +
|category2=
 
}}
 
}}
 
If you do not have Vim 6.0, but would like to mimic the plugins directory feature then copy and paste this into your vimrc:
 
If you do not have Vim 6.0, but would like to mimic the plugins directory feature then copy and paste this into your vimrc:
Line 24: Line 26:
   
 
----
 
----
[[Category:Plugin]]
 

Latest revision as of 11:10, April 24, 2008

Tip 85 Printable Monobook Previous Next

created July 5, 2001 · complexity intermediate · author bubbleboy · version 5.7


If you do not have Vim 6.0, but would like to mimic the plugins directory feature then copy and paste this into your vimrc:

exec "source " . substitute(glob($VIM."/plugins/*.vim"), "\n", "\nsource ", "g")

It will automatically source every Vim script file located in the vim/plugins directory.

Now, to add a new plugin, just drop the script in this directory and Vim will automatically find it.

CommentsEdit

To make Vim look in your home directory for the plugins directory:

Use $HOME, or ~ (tilde), instead of $VIM. If you use tilde, it must be inside the quotes. The $VIM (or $HOME) may be placed inside the quotes as well - glob("$VIM/plugins/*.vim") works just fine.


Around Wikia's network

Random Wiki