I'm trying to use Pathogen
to manage Vim plugins. I had a couple of scripts I made in .vim/ftplugins
.
I installed Pathogen but now none of the scripts in ftplugins runs.
I tried adding a directory inside .vim/bundle
with the scripts but it didn't work (it was .vim/bundle/local/ftplugin/python.vim
)
Any idea how can I make Pathogen load the scripts in ftplugin directory?
First lines of my .vimrc
:
set nocompatible
syntax on
filetype plugin indent on
"execute pathogen#infect()
Only works with that line commented out.
I am running gvim
from a Bash prompt with the filename as first parameter like this:
$ gvim some/path/somefile.py
I expect to see the file with my predefined colorscheme for Python files defined in ~/.vim/ftplugin/python.vim and all the other settings defined in that script.
The ~/.vim/bundle directory is empty.
Pathogen is in ~/.vim/autoload and there is nothing more there.
$ ls ~/.vim/ftplugin/
css.vim html.vim javascript.vim python_pep8.vim python_pyflakes.vim python.vim rst.vim xml.vim
$ ls ~/.vim
autoload bundle colors doc ftdetect ftplugin plugins ScrollColor.vim spell syntax
It was a problem with filetype detection, this is the Pathogen issue.
The work around in my case was simple, use this to enable Pathogen:
set nocompatible
"execute pathogen#infect() " breaks filetype detection
call pathogen#runtime_append_all_bundles()
filetype plugin indent on
syntax on
What I did to find out was to remove my ~/.vim directory and start with a clean one. Adding things one by one and checking the results. I realized it was not detecting the correct filetype (when I opened an empty file detection was ok, but it was not when opening an existing file).
Putting my comment here:
Wondering whether it works if you put :filetype
and :syntax
calls after :execute
? Official README
suggest doing just this in the second section: first :execute
, second :syntax
, third :filetype
. Note: DO NOT disable filetype prior to :execute
like @Eduan suggested, just don’t enable it until :execute
is called:
set nocompatible
execute pathogen#infect()
syntax on
filetype plugin indent on
And, by the way, never use *map
.
I think I can see your problem, putting this in an answer instead of a comment for the sake of the example code's clarity.
Try this:
" Set the filetype stuff to off, required for Pathogen
filetype off
filetype plugin indent off
execute pathogen#infect()
" You can now turn it on again
filetype on
filetype plugin indent on
Instead of your current setup.