简体   繁体   English

在vim中启用语法突出显示会导致警告消息

[英]Turning on syntax highlighting in vim causes warning message

I'm wanting to turn on syntax highlighting in vim using the .exrc file and using the following commands: 我想使用.exrc文件并使用以下命令在vim中打开语法高亮:

syntax on
syntax=html

Every time I open a file I get the following message now: 每次打开文件时,我都会收到以下消息:

No Syntax items defined for this buffer 没有为此缓冲区定义的语法项

I'm using VIM version 7.3 on OS X 10.10.4 我在OS X 10.10.4上使用VIM 7.3版

Use the following in your ~/.vimrc file: ~/.vimrc文件中使用以下内容:

filetype plugin indent on
syntax on

For more information see: 有关更多信息,请参阅

:h :filetype
:h :syntax
:h filetype

If you're trying to set 'syntax' manually, you'd need a :set syntax=html . 如果您尝试手动设置'syntax' ,则需要:set syntax=html But the simpler way is to just open foo.html and :syntax on . 但更简单的方法是打开foo.html:syntax on That should trigger a few settings (like filetype=html and syntax=html . 这应该触发一些设置(如filetype=htmlsyntax=html

For more info, see Vim's :help on :syntax , 'filetype' , and :autocmd . 有关更多信息,请参阅Vim :help on :syntax'filetype':autocmd

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM