Vim:语法文件,加载顺序错误

时间:2017-03-02 16:47:12

标签: vim

我很难弄清楚如何让vim加载文件类型cpp的特定语法文件。

运行:setlocal syntax?会产生syntax=cpp,这使我怀疑第47-48行的cpp.vim已加载。我想要使​​用的实际语法文件位于scriptnames输出的底部。我知道它没有被加载,因为颜色是错误的。

  1: /etc/vimrc                                                      
  2: /usr/share/vim/vimfiles/archlinux.vim
  3: ~/.vimrc
  4: /usr/share/vim/vim80/ftoff.vim
  5: ~/.vim/bundle/Vundle.vim/autoload/vundle.vim
  6: ~/.vim/bundle/Vundle.vim/autoload/vundle/config.vim
  7: /usr/share/vim/vim80/filetype.vim
  8: /usr/share/vim/vim80/ftplugin.vim
  9: /usr/share/vim/vim80/indent.vim
 10: /usr/share/vim/vim80/syntax/syntax.vim
 11: /usr/share/vim/vim80/syntax/synload.vim
 12: /usr/share/vim/vim80/syntax/syncolor.vim
 13: ~/.vim/bundle/nerdtree/plugin/NERD_tree.vim
 14: ~/.vim/bundle/nerdtree/autoload/nerdtree.vim
 15: ~/.vim/bundle/nerdtree/lib/nerdtree/path.vim
 16: ~/.vim/bundle/nerdtree/lib/nerdtree/menu_controller.vim
 17: ~/.vim/bundle/nerdtree/lib/nerdtree/menu_item.vim
 18: ~/.vim/bundle/nerdtree/lib/nerdtree/key_map.vim
 19: ~/.vim/bundle/nerdtree/lib/nerdtree/bookmark.vim
 20: ~/.vim/bundle/nerdtree/lib/nerdtree/tree_file_node.vim
 21: ~/.vim/bundle/nerdtree/lib/nerdtree/tree_dir_node.vim
 22: ~/.vim/bundle/nerdtree/lib/nerdtree/opener.vim
 23: ~/.vim/bundle/nerdtree/lib/nerdtree/creator.vim
 24: ~/.vim/bundle/nerdtree/lib/nerdtree/flag_set.vim
 25: ~/.vim/bundle/nerdtree/lib/nerdtree/nerdtree.vim
 26: ~/.vim/bundle/nerdtree/lib/nerdtree/ui.vim
 27: ~/.vim/bundle/nerdtree/lib/nerdtree/event.vim
 28: ~/.vim/bundle/nerdtree/lib/nerdtree/notifier.vim
 29: ~/.vim/bundle/nerdtree/autoload/nerdtree/ui_glue.vim
 30: ~/.vim/bundle/nerdtree/nerdtree_plugin/exec_menuitem.vim
 31: ~/.vim/bundle/nerdtree/nerdtree_plugin/fs_menu.vim
 32: ~/.vim/bundle/powerline/powerline/bindings/vim/plugin/powerline.vim
 33: /usr/share/vim/vim80/plugin/getscriptPlugin.vim
 34: /usr/share/vim/vim80/plugin/gzip.vim
 35: /usr/share/vim/vim80/plugin/logiPat.vim
 36: /usr/share/vim/vim80/plugin/manpager.vim
 37: /usr/share/vim/vim80/plugin/matchparen.vim
 38: /usr/share/vim/vim80/plugin/netrwPlugin.vim
 39: /usr/share/vim/vim80/plugin/rrhelper.vim
 40: /usr/share/vim/vim80/plugin/spellfile.vim
 41: /usr/share/vim/vim80/plugin/tarPlugin.vim
 42: /usr/share/vim/vim80/plugin/tohtml.vim
 43: /usr/share/vim/vim80/plugin/vimballPlugin.vim
 44: /usr/share/vim/vim80/plugin/zipPlugin.vim
 45: /usr/share/vim/vim80/ftplugin/cpp.vim
 46: /usr/share/vim/vim80/ftplugin/c.vim
 47: /usr/share/vim/vim80/indent/cpp.vim
 48: /usr/share/vim/vim80/syntax/cpp.vim
 49: /usr/share/vim/vim80/syntax/c.vim
 50: ~/.vim/bundle/vim-cpp-enhanced-highlight/after/syntax/c.vim
 51: ~/.vim/bundle/vim-cpp-enhanced-highlight/after/syntax/cpp.vim

如何更改加载顺序?或者甚至强迫它只加载特定的cpp.vim?我的.vimrc可在https://gist.github.com/arynaq/1aa9011f636076e2d2766dff82e8b4af

获取

1 个答案:

答案 0 :(得分:1)

您在options_for_select结果处看到的事实意味着 已加载。

要更改加载顺序,您需要将脚本从:scriptnames移至syntax/after。但我很确定这不是作者希望它如何工作 - 因为标准syntax/将清除突出显示定义的新语法插件。在您的情况下,BTW加载C和C ++的标准语法脚本。他们的存在,第48-49行是正常的。

似乎如果您尝试完成syntax/c.vim,您应该观察此语法插件中的许多:hi cpp个条目。

您需要更加具体地了解您认为错误的内容。但老实说,这对插件作者来说肯定是一个问题。确保您已正确阅读文档并设置选项以满足您的期望。