病原体忽略ftplugin脚本 [英] Pathogen ignoring ftplugin scripts

查看:98
本文介绍了病原体忽略ftplugin脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图使用​​Pathogen来管理Vim插件.我有几个在.vim/ftplugins中制作的脚本.

I'm trying to use Pathogen to manage Vim plugins. I had a couple of scripts I made in .vim/ftplugins.

我安装了Pathogen,但现在ftplugins中的所有脚本都无法运行.

I installed Pathogen but now none of the scripts in ftplugins runs.

我尝试在.vim/bundle中使用脚本添加目录,但是它不起作用(它是.vim/bundle/local/ftplugin/python.vim)

I tried adding a directory inside .vim/bundle with the scripts but it didn't work (it was .vim/bundle/local/ftplugin/python.vim)

有什么想法可以让Pathogen将脚本加载到ftplugin目录中吗?

Any idea how can I make Pathogen load the scripts in ftplugin directory?

我的 .vimrc 的第一行:

First lines of my .vimrc:

set nocompatible
syntax on
filetype plugin indent on
"execute pathogen#infect()

仅适用于被注释掉的那一行.

Only works with that line commented out.

我正在从Bash提示符运行gvim,其文件名是第一个参数,如下所示:

I am running gvim from a Bash prompt with the filename as first parameter like this:

$ gvim some/path/somefile.py

我希望看到带有〜/.vim/ftplugin/python.vim中定义的Python文件以及该脚本中定义的所有其他设置的带有预定义颜色配置的文件.

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.

〜/.vim/bundle目录为空.

The ~/.vim/bundle directory is empty.

Pathogen位于〜/.vim/autoload中,那里没有更多内容.

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

我发现的是删除〜/.vim目录并从一个干净的目录开始.一件一件地添加并检查结果.我意识到它没有检测到正确的文件类型(当我打开一个空文件时,可以检测到,但是在打开现有文件时却没有).

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

这篇关于病原体忽略ftplugin脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆