2

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
Facundo Casco
  • 10,065
  • 8
  • 42
  • 63
  • I would first make sure that you do have Pathogen installed. Second, if they're plugins of your own, I suggest you put them in the normal folder, instead of the `/bundle` folder. Just because it's easier to reach them that way. So put that under `~/.vim/ftplugin/python.vim`. – greduan Jan 10 '13 at 18:42
  • @Eduan Pathogen is installed and my scripts are in the normal folders. When I enable Pathogen in .vimrc the scripts stop loading. – Facundo Casco Jan 10 '13 at 18:45
  • So, your plugins are under `~/.vim/bundle/local/ftplugin/` correct? Could you try moving them to `/.vim/ftplugin/`. I'm not aware of Pathogen deactivating these plugins if you put them there. – greduan Jan 10 '13 at 18:47
  • @Eduan I tried both locations, even at the same time, none of them worked – Facundo Casco Jan 10 '13 at 19:11
  • @Eduan Pathogen AFAIK just adds items to `&rtp`, it does not remove them from there. But if pathogen is installed and run correctly it makes no sense in moving back and forth: this should produce identical results (except for a few edge cases), meaning that pathogen is not actually used correctly. @F.C. It is almost impossible to tell what you have done wrong without seeing your `.vimrc` (better: diff, before and after you installed pathogen). – ZyX Jan 10 '13 at 19:12
  • 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`. – ZyX Jan 10 '13 at 19:30

3 Answers3

2

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

Facundo Casco
  • 10,065
  • 8
  • 42
  • 63
1

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.

ZyX
  • 52,536
  • 7
  • 114
  • 135
  • no luck, the scripts in `ftplugins` still don't work, they work as soon as I comment out the line `execute pathogen#infect()` – Facundo Casco Jan 10 '13 at 20:50
  • @F.C. Wondering then how do you test (exact steps). And what does `bundle/` directory contains. – ZyX Jan 10 '13 at 20:55
  • added the information you ask to the question, I just open a file from a Bash prompt and see if the settings are there (key bindings, colors, etc.) – Facundo Casco Jan 10 '13 at 20:59
  • @F.C. This is not “exact steps”. In order for filetype settings to work you need to open some file, but I see no information about what you open. Ah, and what does `~/.vim` contains? Pathogen itself is installed into `~/.vim/autoload`? – ZyX Jan 11 '13 at 03:41
  • thanks for your comments, I added more information in the question – Facundo Casco Jan 11 '13 at 14:37
  • @F.C. I currently have no idea what it *can* be. Can you provide `:scriptnames` output with and without `:execute` line commented when opening `*.py` file, same for `:echo &runtimepath` (to do this you can just paste from clipboard after using `:redi@+|scrip|ec&rtp|redi END`). Though it is unlikely that it will give the clue right away, so using `set verbosefile=/tmp/verbose.log verbose=15` on the line just before `:execute` call and `set verbose=0` on the line just after and posting the `/tmp/verbose.log` file (after you exit vim) will also be good. – ZyX Jan 11 '13 at 15:31
0

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.

greduan
  • 4,770
  • 6
  • 45
  • 73