0

~/.vim/autoload我已经通过自制软件安装了 MacVim,并通过将 Pathogen.vim 文件下载到我的目录来安装病原体。我已将 vim-perl 插件克隆到~/.vim/bundle目录中。

perl.vim但是,当我打开一个 perl 文件时,它使用MacVimand 包含的文件中的语法突出显示,而不是我下载的插件。这是 的输出:scriptnames。请注意所有 MacVim 提供的插件都在那里,我认为最后列出的 perl 会覆盖我下载的插件:

1: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/vimrc
2: ~/.vimrc
3: ~/.vim/autoload/pathogen.vim
4: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/ftoff.vim
5: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/syntax/syntax.vim
6: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/syntax/synload.vim
7: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/syntax/syncolor.vim
8: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/filetype.vim
9: ~/.vim/bundle/vim-javascript/ftdetect/javascript.vim
10: ~/.vim/bundle/vim-perl/ftdetect/mason-in-html.vim
11: ~/.vim/bundle/vim-perl/ftdetect/perl11.vim
12: ~/.vim/bundle/vim-ruby/ftdetect/ruby.vim
13: ~/.vim/bundle/vim-scala/ftdetect/scala.vim
14: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/menu.vim
15: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/autoload/paste.vim
16: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/ftplugin.vim
17: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/indent.vim
18: ~/.vim/colors/default.vim
19: ~/.vim/bundle/vim-scala/plugin/scala.vim
20: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/plugin/getscriptPlugin.vim
21: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/plugin/gzip.vim
22: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/plugin/matchparen.vim
23: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/plugin/netrwPlugin.vim
24: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/plugin/rrhelper.vim
25: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/plugin/spellfile.vim
26: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/plugin/tarPlugin.vim
27: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/plugin/tohtml.vim
28: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/plugin/vimballPlugin.vim
29: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/plugin/zipPlugin.vim
30: ~/.vim/bundle/vim-scala/after/plugin/help.vim
31: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/gvimrc
32: ~/.vim/bundle/vim-perl/syntax/perl.vim
33: ~/.vim/bundle/vim-perl/syntax/pod.vim
34: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/syntax/pod.vim
35: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/syntax/perl.vim
36: ~/.vim/bundle/vim-perl/ftplugin/perl.vim
37: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/ftplugin/perl.vim
38: ~/.vim/bundle/vim-perl/indent/perl.vim
39: /usr/local/Cellar/macvim/7.4-73/MacVim.app/Contents/Resources/vim/runtime/indent/perl.vim

这是我的~/.vimrc文件

set shell=/bin/sh

call pathogen#infect()

filetype off
syntax on
filetype plugin indent on

如果我:so ~/.vim/bundle/vim-perl/syntax/perl.vim那么文件语法正确突出显示。

如何防止 MacVim 捆绑的覆盖?

4

1 回答 1

0

包含保护 ( if exists("b:current_syntax")) 应该防止默认的 Perl 语法脚本产生任何影响(在您的自定义脚本获得源之后)。

作为一种解决方法,您可以将自己的脚本从 移动~/.vim/bundle/vim-perl/syntax/perl.vim~/.vim/bundle/vim-perl/after/syntax/perl.vim,或者创建一个~/.vim/after/syntax/perl.vim脚本

so ~/.vim/bundle/vim-perl/syntax/perl.vim

在里面。

于 2014-11-14T08:53:57.733 回答