Pathogen ignoring ftplugin scripts
Asked Answered
K

3

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
Kiser answered 10/1, 2013 at 18:3 Comment(6)
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.Unexacting
@Eduan Pathogen is installed and my scripts are in the normal folders. When I enable Pathogen in .vimrc the scripts stop loading.Kiser
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.Unexacting
@Eduan I tried both locations, even at the same time, none of them workedKiser
@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).Dasie
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.Dasie
K
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).

Kiser answered 11/1, 2013 at 15:43 Comment(0)
D
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.

Dasie answered 10/1, 2013 at 20:47 Comment(6)
no luck, the scripts in ftplugins still don't work, they work as soon as I comment out the line execute pathogen#infect()Kiser
@F.C. Wondering then how do you test (exact steps). And what does bundle/ directory contains.Dasie
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.)Kiser
@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?Dasie
thanks for your comments, I added more information in the questionKiser
@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.Dasie
U
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.

Unexacting answered 10/1, 2013 at 19:39 Comment(4)
@F.C. Hmm... Have no idea what it could be then. :(Unexacting
See the source code of pathogen#infect: it does setting filetype off and then on on its own.Dasie
Ah I see, I use Vundle, thought it would be the same procedure (since Vundle does say it's the same except the extras).Unexacting
I removed all the lines filetype but the scripts in ftplugins are not usedKiser

© 2022 - 2024 — McMap. All rights reserved.