gvim pathogen issues - vim

I downloaded pathogen.vim from github and put it in "autoload" directory under ~/.vim. However now when I fire up gvim, and do :helptags, it says "Argument required". The contents of my ~/.vimrc file are:
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
What am I missing?
Thanks.
Andy
PS: I am doing this so that I can install Nerdtree
--- EDIT 1 ---
Based on what I have seen so far, the pathogen.vim plugin from github did not work for me, so I had to download it from vim.org, and it worked. However now when I do "unzip nerd_tree -d ~/.vim/bundle" and then start up gvim, I can still not find nerdtree.
-----End ---------

According to the pathogen README on github site, you should use :Helptags instead of :helptags. With :Helptags command executed, pathogen should generate all the documentations under directory ~/.vim/bundle now.

helptags is a vim command which has nothing to do with pathogen. The helptags command in vim takes a directory as an argument where it will process .txt files and generate the tags file.
To tell if pathogen is loading correctly you should be able to attempt to :call pathogen#helptags(). If running that manually does not fail, then pathogen is loaded (this is actually unnecessary if you are not getting an error when you start vim because your .vimrc is already running these commands).
The next step for you to complete is to read the documentation provided here on how to install a plugin as a bundle. To summarize:
Make a directory called ~/.vim/bundle
Unzip/clone/copy files from an upstream source into ~/.vim/bundle/plugin-name/. This may contain many files and directories (ftplugin, autoload, doc, etc.).
Fire up vim and test that the functionality provided by plugin-name is available. If not, check that you have completed the above steps correctly.
If you're having problems with pathogen, just remember installing a bundle is not all that different than installing a plugin the normal way. The advantage is you get to keep all files and folders related to that specific plugin in their own directory. This allows you to manage each plugin individually and be confident you are only touching files related to that plugin.

I use pathogen and I find it great, but you don't need pathogen at all to use NERDTree.
Just put the files like this then issue :helptags ~/.vim/doc and it will work:
~/.vim/doc/NERD_tree.txt
~/.vim/nerdtree_plugin/exec_menuitem.vim
~/.vim/nerdtree_plugin/fs_menu.vim
~/.vim/plugin/NERD_tree.vim
My setup with pathogen is very standard:
~/.vim/bundle/NERD_tree/doc/NERD_tree.txt
~/.vim/bundle/NERD_tree/nerdtree_plugin/exec_menuitem.vim
~/.vim/bundle/NERD_tree/nerdtree_plugin/fs_menu.vim
~/.vim/bundle/NERD_tree/nerdtree_plugin/insert_image.vim <-- a custom script not included with the distribution
~/.vim/bundle/NERD_tree/plugin/NERD_tree.vim
and works like a charm.
It it helps, here are the first lines of my ~/.vimrc:
" This must be first, because it changes other options as side effect
set nocompatible
" Use pathogen to easily modify the runtime path to include all plugins under
" the ~/.vim/bundle directory
filetype off " force reloading *after* pathogen loaded
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
filetype plugin indent on " enable detection, plugins and indenting in one step

Related

How to enable a plugin manager without ~/.vimrc

After using vim for some time now, my ~/.vim/ beginning with my first experiments with vim got really messy over time. So I thought, it would be time to tidy up and to begin with a plugin manager with a clean configuration.
Since I share my configuration over multiple machines, I usually manage my ~/.vim/ path with a git repo. To avoid a big .vimrc, I put my own configuration under ~/.vim/plugin/. This allowed me, to keep all my shared configuration in this folder and to use ~/.vimrc only for machine dependent configuration.
Starting with VAM over NeoBundle and now Vundle I have always the same problem. If I add the required configuration under ~/.vim/plugin/pluginmanager.vim instead of ~/.vimrc, the installed plugins do not load or were only partially loaded. The command :echo &rtp lists the correct bundles, but :scriptnames does not include the installed plugins. If I execute mv ~/.vim/plugin/pluginmanager.vim ~/.vimrc everythings works as expected.
Can anyone explain this behavior and perhaps offer a solution?
My pluginmanager.vim looks like this:
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'bling/vim-airline'
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'tomtom/tlib_vim'
Plugin 'garbas/vim-snipmate'
Plugin 'honza/vim-snippets'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
My vim installation is version 7.4.52
The problem is in the startup order. After your ~/.vimrc has been executed (as the first thing during startup), Vim executes something like :runtime! plugin/*.vim to load the plugins. As your plugin manager is only then invoked, the changes in the 'runtimepath' do not reach that triggering :runtime command any more, and the plugins fail to load.
There are many workarounds:
Move your script to ~/.vim/pluginmanager.vim and explicitly :runtime pluginmanager.vim it from (each copy of) your ~/.vimrc.
Re-trigger via :runtime! plugin/*.vim.
But I agree with #brettanomyces that the best solution would be to use ~/.vimrc as intended, and place system-specific configuration into a different script instead.
I would recommend using the ~/.vimrc file for general configuration and having another file such as ~/.vimrc.local with your machine specific configuration. You can source ~/.vimrc.local by adding the following to your ~/.vimrc.
if filereadable(glob("~/.vimrc.local"))
source ~/.vimrc.local
endif
Credit: http://blog.sanctum.geek.nz/local-vimrc-files/
To solve your issue try adding runtime! bundle/**/*.vim to the end of your pluginmanager.vim file.
See also: :help init

Can't install vim plugins with pathogen

I am connecting to my university's computers. I am trying to customize vim. They put their vim configuration files in the protected /usr/share folder where I have no permissions.
I copied the .vimrc file to my home directory and started changing. This seemed to work :-)
Step 2,
I installed pathogen as instructed here:
http://mirnazim.org/writings/vim-plugins-i-use/
I added the following lines to .vimrc
execute pathogen#infect('~/.vim/bundle/{}')
call pathogen#helptags()
Unfortunately vim doesn't recognize my plugins (for example TagBar). I tried to play with the argument in infect, change execute to call, and etc.
Nothing helped.
Interestingly enough when I do :scriptnames I see that ~/.vim/autoload/pathogen.vim shows. Files in bundle directory don't show though :-(.
Ideas?
I know it is kind of obvious, but your plugins folders actually have files inside?
Some people already missed it: Vim: Pathogen not loading
how can i make my plugin work? maybe without pathogen?
some people like it, other not, but I'd advice you to use Vundle instead of pathogen. Here's a nice post about why, but honestly the main reason is that it's just stupid simple to manage plugins using it.
The installation process is very easy:
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
and edit .vimrc :
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
" … new bundles here
filetype plugin indent on
And for each new plugin I want to install, I do add the following to my .vim rc, where the comment is:
Bundle "user/plugin"
and then you execute :BundleInstall on a new instance.
Elegant and simple, what else do you want?

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.

Pathogen (Vim) non-default bundle directory location

I like the idea of keeping all my Vim plugins and my vimrc in Dropbox. I also love pathogen. Looking at the pathogen.vim file, it seems I can provide the pathogen#infect() function with an alternative location for my bundle folder. But this just doesn't work. I've searched high and low for a solution, but nothing I do will allow me to change the 'working directory', as it were, for pathogen to '~/Dropbox/Vim/GlobalRuntimePath/bundle'. I've tried sourcing pathogen.vim directly in my vimrc, to no avail. Pathogen doesn't complain, just my vimrc when it tries to call upon functions from plugins that no longer exists when I remove their local copies.
Am I asking the wrong questions?
There is a way for adding custom bundle directories provided in
Pathogen. First, one should append paths to the directories containing
additional bundles to the runtimepath option:
:set runtimepath+=~/Dropbox/Vim/GlobalRuntimePath
Then, when loading Pathogen in .vimrc file, one should specify the
name of all bundle directories (they must have the same one) as the
argument to the runtime_append_all_bundles call:
:call pathogen#runtime_append_all_bundles('bundle')
If bundle directories are named by default, bundle, the argument can
be omitted.

Moving vimfiles location breaks snipmate.vim?

I'm working on moving my whole vim config to my Dropbox folder in order share it between machines more effectively. To do this, I've changed my .vimrc to the following:
set runtimepath+=$HOME/My\ Documents/Dropbox/vim
source $HOME\My Documents\Dropbox\vim\vimrc.vim
vimrc.vim looks like this:
set nocompatible
filetype on
filetype plugin on
filetype indent on
syntax enable
The problem is then that snipMate.vim no longer works. I know that there aren't any plugins interfering with it, as I've done a fresh install of vim and removed all the other plugins. It worked perfectly before I moved the plugins to the dropbox folder. I think it may have something to do with the fact that the after directory in vimfiles doesn't seem to be getting read once I move the plugin folder to the dropbox (i.e. after/snipmate.vim only shows up in :scriptnames when I have vimfiles as the plugin folder). I've tried explicitly sourcing the script in the after directory by adding the following to my .vimrc:
source $HOME\My Documents\Dropbox\vim\after\plugin\snipMate.vim
but snipmate still doesn't work.
Any ideas on fixing this?
You have to add the after directory to 'runtimepath' if you want Vim to look for it.
set runtimepath^=$HOME/My\ Documents/Dropbox/vim
set runtimepath+=$HOME/My\ Documents/Dropbox/vim/after
This follows the normal behavior of having your personal vim directory sourced first, then the system-wide stuff, and finally your personal after directory.

Resources