简体   繁体   English

Vim只突出显示〜/ .vimrc

[英]Vim Only Highlighting ~/.vimrc

I am a new vim user and trying to turn on syntax coloring for vim on Mac OS X. I followed http://vim.wikia.com/wiki/Turn_on_syntax_coloring_in_Mac_OS_X 's instructions, and my ~/.vimrc file has the following content 我是一个新的vim用户,并尝试在Mac OS X上打开vim的语法着色。我按照http://vim.wikia.com/wiki/Turn_on_syntax_coloring_in_Mac_OS_X的说明操作,我的〜/ .vimrc文件包含以下内容

set term=builtin_ansi
filetype plugin indent on
syntax on

And the text above in ~/.vimrc is highlighted perfectly fine. 并且〜/ .vimrc中的上面的文字非常精确地突出显示。 However, whenever I use vim to edit a current text file or create a new one, I only see black and white text, and manually calling :syntax on does nothing. 但是,每当我使用vim编辑当前文本文件或创建新文件时,我只会看到黑白文本,并且手动调用:syntax on什么都不做。 Any help is apprecaited! 任何帮助都是适合的!

You should remove that useless line: 你应该删除那个无用的行:

set term=builtin_ansi

Do you use the default Vim? 你使用默认的Vim吗? What filetypes are you editing? 您正在编辑哪些文件类型?

You can use the :highlight command to list all defined groups (according to your colorscheme ). 您可以使用:highlight命令列出所有已定义的组(根据您的colorscheme )。 A plain text file probably has no filetype and therefore no syntax assigned; 纯文本文件可能没有文件类型 ,因此没有分配语法; you want to try this with any programming language (eg *.py or *.c ) to see syntax highlighting in action. 您想尝试使用任何编程语言(例如*.py*.c )来查看语法高亮显示。

Your ~/.vimrc looks fine. 你的~/.vimrc看起来很好。 (Do you really need the :set term , though?!) (你真的需要:set term吗?!)

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

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