0

I have installed MacVim via homebrew, and pathogen via downloading the pathogen.vim file to my ~/.vim/autoload directory. I have got cloned the vim-perl plugin into ~/.vim/bundle directory.

However, when i open a perl file, it uses the syntax highlighting from the perl.vim file included with MacVimand not my downloaded plugin. This is the output of :scriptnames. Note all the MacVim supplied plugins are there and I think the perl ones listed last overwrite my downloaded plugin:

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

Here is my ~/.vimrc file

set shell=/bin/sh

call pathogen#infect()

filetype off
syntax on
filetype plugin indent on

If I :so ~/.vim/bundle/vim-perl/syntax/perl.vim then the file syntax highlights correctly.

How can I prevent the MacVim bundled ones overriding?

cubabit
  • 2,527
  • 3
  • 21
  • 34
  • Try moving `filetype off` *above* `call pathogen#infect()`. – romainl Nov 13 '14 at 18:20
  • Nope, that made no difference. The files are still there in the same order in `:scriptnames` – cubabit Nov 13 '14 at 22:56
  • What is `runtimepath` set to? – JP Flouret Nov 13 '14 at 23:10
  • `runtimepath=~/.vim,~/.vim/bundle/default,~/.vim/bundle/vim-javascript,~/.vim/bundle/vim-perl,/usr/local/Cellar/macvim/7.4-73_1/MacVim.app/Contents/Resources/vim/vimfiles,/usr/local/Cellar/macvim/7.4-73_1/MacVim.app/Contents/Resources/vim/runtime,/usr/local/Cellar/macvim/7.4-73_1/MacVim.app/Contents/Resources/vim/vimfiles/after,~/.vim/after` – cubabit Nov 13 '14 at 23:18
  • Looks like my bad :( It was loading the syntax but some was disabled because I had not put it in `after/...` – cubabit Nov 14 '14 at 18:11

1 Answers1

0

The inclusion guard (if exists("b:current_syntax")) should prevent the default Perl syntax script from having any effect (after your custom one has been sourced).

As a workaround, you could move your own script from ~/.vim/bundle/vim-perl/syntax/perl.vim to ~/.vim/bundle/vim-perl/after/syntax/perl.vim, or alternatively create a ~/.vim/after/syntax/perl.vim script with

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

in it.

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324