I had old vundle installed. Instead of using git pull to update vundle, I removed old vundle from ~/.vim and installed it following Quick Start section in the Github page of vundle.
Maybe I broke something when I installed new vundle. I get this:
jack#Jack-PC ~ $ vim .vimrc
Error detected while processing /home/jack/.vimrc:
line 6:
E117: Unknown function: vundle#begin
line 15:
E117: Unknown function: vundle#end
Press ENTER or type command to continue
I followed the instructions on the Github page exactly.
" .vimrc
set nocompatible
filetype off
" Vundle
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"
"" Vundle Plugins List
"Plugin 'gmarik/Vundle.vim'
"Plugin 'php.vim'
"Plugin 'neocomplcache'
"Plugin 'rails.vim'
"Plugin 'bling/vim-airline'
"
call vundle#end()
filetype plugin indent on
Your .vimrc seems fine. Looks like you have not installed the vundle plugin properly.
Run this command on your console.
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
You should have a directory structure like (I simplified it):
~/.vim
├── bundle/
│ └── Vundle.vim <------------------ Vundle
├── colors/
│ └── Tomorrow.vim
└── plugin/
└── acp.vim
maybe the rtp location is wrong,you can type
:echo &rtp
in Vim to see whether the location of ~ stand for is correct.
you can replace
set rtp+=~/.vim/bundle/Vundle.vim
to
set rtp+=/home/[YourUserName]/.vim/bundle/Vundle.vim //do not use ~
I met this issue again.
After checked, the reason why is that there is more than one bundle environment in computer, you can :echo &rtp, and see other environment, and remove other bundle directory.
I think the best answer is:
set rtp+=$HOME/.vim/bundle/Vundle.vim " in OS X
of course, you can find out: echo $HOME, is it your home directory or not.
I just make an empty directory named 'Vundle.vim' in '~/.vim/bundle' when I install it for vim in msys2.
Related
The example I am following is from the book The VimL Primer Chap 4.
In the ftdetect dir I have the following line:
autocmd BufRead,BufNewFile *.mpdv set filetype=mpdv
In a file called mpdv.vim
However this command is not executed when I open a mpdv file.
In .vimrc I have:
filetype plugin on
The way im loading the plugin is the following:
In ~/.vimrc I have:
set exrc
This forces vim to load local .vimrc files
Then in my projects pluginfolder i have the follwoing .vimrc
set runtimepath+=path/to/my/plugin
What can I do the debug why vim is not loading my autocmd when I open a mpdv file?
One thing I've noticed (and which seems to be the deal with your case as well) is that if you add new path on runtimepath, you should have the filetype plugin on done after updating the runtimepath.
For example, with the following vimrc, it would work fine:
set runtimepath+=/home/techgaun/fun/vim/mpc
filetype plugin indent on
And, if you run :scriptnames, you should see the ftdetect script loaded fine from your mpc plugin directory.
In my case, vim appeared to not be sourcing the files under the ftdetect and ftplugin directories in the custom runtimepath. I tried putting the directories under my .vim folder:
.vim
├── autoload
│ └── mpc.vim
├── ftdetect
│ └── mpdv.vim
├── ftplugin
│ └── mpdv.vim
└── plugin
└── mpc.vim
Now the script under ftdetect runs, as can be seen when I run :scriptnames:
1: /usr/share/vim/vimrc
2: /usr/share/vim/vim74/debian.vim
3: ~/.vimrc
4: /usr/share/vim/vim74/filetype.vim
5: ~/.vim/ftdetect/mpdv.vim
6: /usr/share/vim/vim74/ftplugin.vim
7: /usr/share/vim/vim74/syntax/syntax.vim
8: /usr/share/vim/vim74/syntax/synload.vim
9: /usr/share/vim/vim74/syntax/syncolor.vim
10: ~/.vim/plugin/mpc.vim
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
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?
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.
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