Can't install vim plugins with pathogen - vim

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?

Related

problems installing vim-misc and vim-session plugins on mac / macvim

When I follow github instructions for vim-misc and vim-sessions, after unzipping to /Users/<me>/.vim/misc and /Users/<me>/.vim/vim-session-master, and then restarting macvim, I get
:helptags ~/.vim/doc
E150: Not a directory: ~/.vim/doc
Also tried putting the two folders in /Users/<me>/ (where my .vimrc is) and in the two locations pointer by $VIM and $VIMRUNTIME from within macvim (/Applications/MacVim.app/Contents/Resources/vim) all to no avail.
I guess I really don't understand how running the :helptags <whatever> starts up/completes installation of these plug-ins anyway?
Before using using a plugin managers, plugins used to go directly into ~/.vim, not into ~/.vim/pluginname. That's when we ran :helptags ~/.vim/doc.
Then we had plugin manager, each with different specific way of doing things. Some even take care of registering the documentation of the plugins installed.
IMO, you'd better find a plugin manager suited to your need and use it. I remember a Q/A on vi.SE, you could start by reading it.
If you prefer to install plugins manually instead of using one of plugin managers like vim-plug or others then you should add plugin directory to your runtimepath. Place this line to your .vimrc set runtimepath+=/path/to/plugin. I would not recommend to place plugins directly to ~/.vim directory, use sub-folder instead (e.g. /Users/<you>/.vim/plugins).

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

fastest way to make vim use new plugin in ~/.vim/bundles

I'm using pathogen with vim.
When I add a new plugin to the ~/.vim/bundle directory what's the fastest way to make my existing MacVim window start using it? Do I have to close it and open a new one or is there a quick command I can run?
You can use vim-addon-manager instead of pathogen. It uses bundle-like directory too, but when you call
ActivateAddons snipMate
if snipmate was not installed, VAM will install it and then source so that you don’t need to restart. You will have to add some call to vam#ActivateAddons() with 'snipMate' in arguments to the vimrc though.
If you don't mind trying an alternative to Pathogen, check out Unbundle which lets you call :Unbundle manually to "rescan" your ~/.vim/bundle directory without closing Vim. It also supports filetype specific bundles, which can be manually rescanned in a similar fashion.

gvim pathogen issues

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

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