pathogen not loading plugins in GVIM - vim

I'm having trouble using pathogen with GVIM on Windows 10.
So far, I've installed GVIM in C:/Program Files (x86)/, vim-pathogen in C:/Program Files (x86)/Vim/vimfiles/autoload and my plugins in C:/Program Files (x86)/Vim/vimfiles/bundle.
I've renamed the standard _vimrc to vimrc_original, so it goes undetected (excerpt):
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set diffexpr=MyDiff()
function MyDiff()
(<definition of function ...>)
I've placed a custom .vimrc in my user directory C:/Users/User (~\), which is detected by GVIM (excerpt):
set langmenu=en_US
let $LANG = 'en_US'
colorscheme industry
execute pathogen#infect()
filetype plugin indent on
syntax on
"<(non relevant part) ...>
On invoking :scriptnames, however, none of my plugins in C:/Program Files (x86)/Vim/vimfiles/bundle are listed; only the scripts in GVIM's runtime folder C:/Program Files (x86)/Vim/vimM80/:
1: ~\.vimrc
2: C:\Program Files (x86)\Vim\vim80\colors\industry.vim
3: C:\Program Files (x86)\Vim\vimfiles\autoload\pathogen.vim
4: C:\Program Files (x86)\Vim\vim80\filetype.vim
5: C:\Program Files (x86)\Vim\vim80\menu.vim
6: C:\Program Files (x86)\Vim\vim80\autoload\paste.vim
7: C:\Program Files (x86)\Vim\vim80\ftplugin.vim
8: C:\Program Files (x86)\Vim\vim80\indent.vim
9: C:\Program Files (x86)\Vim\vim80\syntax\syntax.vim
10,11: (other syntax files)
12: C:\Program Files (x86)\Vim\vim80\plugin\getscriptPlugin.vim
13-22: (other plugin files)
23: C:\Program Files (x86)\Vim\vim80\plugin\zipPlugin.vim
Why aren't my custom plugins C:/Program Files (x86)/Vim/vimfiles/bundle loaded by pathogen, instead of only the ones in GVIM's runtime folder C:/Program Files (x86)/Vim/vimM80/?
As a test, I am not able to open NERDTree, but my keymap for it works; .vimrc is detected but not the plugin.
Note.
I have already tried following the steps mentioned in this guide, to no avail. The only difference being that I've installed GVIM in Program Files, instead of my home folder, which shouldn't be relevant for my case.
Update
On seeing the result of set runtimepath?:
runtimepath=~/vimfiles,~\vimfiles\bundle\ale,~\vimfiles\bundle\ctrlp.vim,~\vimfiles\bundle\jscheck,~\vimfiles\bundle\neosnippet.vim,~\vimfiles\bundle\nerdtree,~\vimfiles\bundle\omnisharp-vim,~\vimfiles\bundle\tlib_vim,~\vimfiles\bundle\tsuquyomi,~\vimfiles\bundle\typescript-vim,~\vimfiles\bundle\vim-addon-mw-utils,~\vimfiles\bundle\vim-airline,~\vimfiles\bundle\vim-dispatch,~\vimfiles\bundle\vim-markdown,~\vimfiles\bundle\vim-snipmate,~\vimfiles\bundle\vimproc.vim,~\vimfiles\bundle\YouCompleteMe,C:\Program Files (x86)\Vim/vimfiles,C:\Program Files (x86)\Vim\vim80,C:\Program Files (x86)\Vim/vimfiles/after,~/vimfiles/after
I guess pathogen is working after all. But I don't understand why the plugins are not accessable. If the plugins are in Vim's runtimepath this means Vim knows where to look for the plugins, as I understand it.

C:\Program Files (x86)\Vim\ is off-limits. Customization is supposed to happen in %USERPROFILE%\vimfiles and nowhere else:
%USERPROFILE%\vimfiles\vimrc <-- your vimrc
%USERPROFILE%\vimfiles\autoload\pathogen.vim <-- the pathogen script
%USERPROFILE%\vimfiles\bundle\ <-- your plugins
See this repo for general advices.

Related

Vim error: cannot create diffs. Vim folder has no diff.exe

When trying to use vim diff to compare two files on windows 7, I get an error message: cannot create diff. My vim version is 7.4.965.
Searching for this on the internet, it seems that C:/Program Files/Vim/vim74 should normally contain a diff.exe: it doesn't in my case.
Is this a correct assumption, and if so, how can I fix my Vim installation?
Did you see vim.exe in this directory?
My vim is installed in C:/Program Files(x86)/Vim/vim74

vim - should i place all .vim files when enabling a plugin in vimfiles or vim74 folder?

Do all .vim files go into vimfiles or vim 74 folders when installing a plugin? on windows 7 and is this the standard for all vim plugins?
Thanks
If you have a single name.vim file, that usually goes into %HOMEDRIVE%\%HOMEPATH%\vimfiles\plugin\ on Windows. If this doesn't exist yet, create it. You can check the actual locations from within Vim via
:echo &runtimepath
Directories under C:\Program Files\vim\vim74 are reserved for the scripts that come with Vim. You must not put any files there; that'll just cause problems when upgrading!
On Windows, third party plugins and colorschemes are supposed to go in this directory:
%userprofile%\vimfiles\
including your vimrc if you only use Vim 7.4:
%userprofile%\vimfiles\vimrc

Where do I save pathogen.vim so that the plugin installs

I've just downloaded the file pathogen.vim from vim.org
Where do I save this file so that it becomes part of gVim? In one of the runtimepath locations?
Does this .vim need to go in either of these locations?:
- C:\Program Files (x86)\Vim73\
- C:\Program Files (x86)\Vim\vimfiles\
You don't need pathogen to install plugins.
For the nth time this week, put your plugins into the C:\Users\username\vimfiles directory and your settings into the C:\Users\username\_vimrc file. You must create those directories/files yourself.
What you should have:
C:\Users\username\_vimrc
C:\Users\username\vimfiles\
C:\Users\username\vimfiles\autoload\
C:\Users\username\vimfiles\autoload\pathogen.vim
C:\Users\username\vimfiles\bundle\
Many Vim plugins have UNIX-oriented instructions and Vim itself is mostly UNIX-oriented so you'd better learn a thing or two about the UNIX command line.
If you are using windows, I recommend that you install your gVim into a custom directory instead of under Program Files or Program Files (x86) directories.
This makes things a lot easier going forward.
For instance, in a location like this:-
Install gvim in your user's home directory (e.g. C:\Users\whytheq\) (where whytheq is your user name) so it becomes C:\Users\whytheq\Vim73\.
Then, create a _vimrc file (with no file extension) there as well with the following contents:
set nocp
call pathogen#infect()
syntax on
filetype plugin indent on
Next, create a folder under C:\Users\whytheq\Vim73 called vimfiles with two subfolders beneath that, autoload and bundle.
Then, download the pathogen.vim file and moved it into the autoload folder.

pathogen#infect not updating the runtimepath

I have started working with pathogen.vim with gvim on Windows, following Tim Pope's setup guide at his github repository here.
However, I'm running into the problem that pathogen#infect() does not seem to be modifying the runtimepath (as seen by running :echo &runtimepath in gvim).
The simple test case _vimrc that I came up with is as follows. Please note that pathogen gets loaded just fine.
"Set a base directory.
let $BASE_DIR='H:\development\github\vimrc'
"Source pathogen since it's not in the normal autoload directory.
source $BASE_DIR\autoload\pathogen.vim
"Start up pathogen
call pathogen#infect()
"call pathogen#infect('$BASE_DIR\functions')
Neither running pathogen#infect() without an argument (which should add the bundles directory under the vimfiles directory) nor specifying a directory to contain files works.
Substituting the pathogen#infect() call with pathogen#runtime_prepend_subdirectories('$BASE_DIR\functions'), which is what pathogen#infect() does fails to change the runtimepath as well.
Any ideas that I've missed? Any more information that would be helpful?
My repository with the non-trivial example is here.
EDIT
In addition to creating directories under the directory I infected, as mentioned by qqx, I renamed those directories to plugin and colors which Vim will automatically load vim files from.
pathogen#infect() doesn't add the bundle directory or the directory named in the argument to &runtimepath, only subdirectories of that directory. In your github repository, the vimrc file uses the functions directory as the argument, but that directory only has files in it no subdirectories.

Plugins in gVim not working

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!
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.
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.

Resources