Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plugins in gVim not working

Tags:

vim

vim-plugin

I need help in installing some of the popular plugins in Vim. I just started learning this editor and is very excited to use the popular plugins. I'm using gVim in Windows XP and have extracted the .vim files and copied them to the Program Files folder of Vim.

Inside my "F:\Program Files\Vim" folder, there are exactly two folders the "vim73" and the "vimfiles" folder. I put the .vim files (EasyMotion.vim) into the "plugin" folder inside the "vimfiles" folder.

When I run gVim, the plugins doesn't work, and in my case, the EasyMotion plugin is not working. I typed the "/w" to make the EasyMotion plugin work (as stated on its usage on its github account) and nothing seems to work.

Am I missing out something here? Are there extra commands to put in the vimrc file to recognize those plugins?

Cheers!

like image 424
Panoy Avatar asked Jan 03 '12 07:01

Panoy


2 Answers

Never touch Program Files. There is a vim setting called 'runtimepath' (see the :help 'rtp') that says where Vim is going to locate the plugins. For each directory in the runtimepath, Vim will source every .vim file found in the plugin subfolder, and lookup for functions containing # in their names in the .vim files of the autoload folder. It will also lookup filetype plugins in the ftplugin folder when 'ft' is set.

Normally you should have %HOMEPATH%\Vim\vimfiles in your runtimepath (:echo &rtp to know). Unzip Easymotion there, NOT in Program Files.

Due to that structure, vim plugins mix up in the same 2-3 folders. However it is possible to install every plugin in its own subfolder if you play with runtimepath. The pathogen plugin is dedicated to that. It makes it possible to have every plugin in its own subfolder, and adds every plugin root folder to the runtimepath. The Readme is self-explanatory.

like image 95
Benoit Avatar answered Nov 03 '22 05:11

Benoit


As @benoit said, you should never in general put files into your vim73 folder (notable exceptions exist, but you'll know when you encounter them).

On windows, Vim searches for configuration files (those include _vimrc and your plugins) in several directories, in a certain order. First it will look in

  • $HOME ... which is your c:\documents and settings\username\ folder
  • $VIM ... which is the folder where you installed or extracted Vim
  • $VIMRUNTIME ... which is your \vim73 folder ...

and so on ...

What this means? It means it will first look in $HOME before looking in let's say, your Vim install folder. So it is a nice way of separating plugins which you just want to test out before being sure you're gonna be keeping them.

For example, you could organize your Vim related files in this manner:
- install vim to c:\vim or c:\program files\vim\
(vim's program files will go in \...\vim\vim73\)
- put your _vimrc in \vim\
- put your vimfiles in \vim\vimfiles\
- and put your temporary vimfiles in c:\documents and settings\username\vimfiles\

That way when you're done with them, you can just delete that last \username\vimfiles\ folder.

like image 20
Rook Avatar answered Nov 03 '22 07:11

Rook