vim-syntax-highlighting

Enable Vim Syntax Highlighting By Default

房东的猫 提交于 2019-11-28 03:44:00
I know how to turn syntax highlighting on and off in vim by running this in the editor: :syntax on/off But I want syntax highlighting to be enabled by default, so I don't have to turn it on every time I run vim. How do I do this? Edit your $HOME/.vimrc (Unix/Linux/OSX) or $HOME/_vimrc (Windows) to include the following line: syntax on EDIT If your syntax highlighting doesn't work when you start Vim, you probably don't have a $HOME/.vimrc or $HOME/_vimrc (known collectively as vimrc from now on). In that case, you have two options: Create an empty vimrc . Copy vimrc_example.vim as your vimrc

Embedded syntax highligting in Vim

非 Y 不嫁゛ 提交于 2019-11-27 18:25:23
I have a custom XML file format which can contain blocks of code within certain tags. For example: <Root> <Sql> select * from foo </Sql> <MoreJunk> ... </MoreJunk> <Python><![CDATA[ def Bar(*args): return False ]]></Python> </Root> How can I get Vim to use SQL syntax highlighting for the text inside <Sql> tags and use Python higlighting for text inside <Python> tags? I know Vim can already do this because it correctly highlights Javascript inside HTML files. I tried inspecting the HTML syntax file but couldn't figure it out. For your XML with python example you would have to do something like

Highlight python docstrings as comments (vim syntax highlighting)

若如初见. 提交于 2019-11-27 14:53:53
问题 Is it possible to modify python.vim (and the corresponding colorscheme file) such that triple-quoted strings right under class and def statements (a.k.a. docstrings) will be highlighted as comments during python syntax highlighting under vim? class URLopener: """Class to open URLs. This is a class rather than just a subroutine because we may need more than one set of global protocol-specific options. Note -- this is a base class for those who don't want the automatic handling of errors type

How to override default syntax highlight in vim?

喜夏-厌秋 提交于 2019-11-27 13:57:30
问题 In VIM, I need to perform a simple task - highlight "(" and ")". I can do this easily by issuing two commands: :syn match really_unique_name display "[()]" :hi really_unique_name guifg=#FF0000 But if I add same commands (without ':' of course) to empty .vimrc and restart VIM - "(" and ")" are not highlighted anymore in .cpp files. It seems that if i create/load .cpp file, VIM loads syntax file for it that overrides my custom highlights. How can i configure highlights in my .vimrc file so it

HTML syntax highlighting in javascript strings in vim

≡放荡痞女 提交于 2019-11-27 03:35:39
问题 I don't know if this is possible/sensible, but I was curious to know if I can have my strings in javascript files have html highlighting. I discovered that strings in php could have SQL syntax highlighting, so I believe it is possible. But, I don't know vim-scripting, so any help on this appreciated. I am using the Better Javascript syntax. PS: If there could be an option to turn it on and off while editing a js file, that would be wonderful Thanks 回答1: Yes, it's possible if you don't mind

class & function names highlighting in Vim

独自空忆成欢 提交于 2019-11-27 02:34:56
I just recently set up my Vim environment from Textmate, after becoming addicted to its modal input. However, syntax highlighting seems to be not so beautiful in Vim. I code in C++ and since the function call and class names can't be highlighted, the code is more difficult to read. I played with color scheme for a bit, but couldn't find any field that corresponded to "class name" or "function name". In the picture below, notice how DroughtLayer:: and *.size() is not highlighted on the right in MacVim. (source: ivzhao.com ) Any ideas how to solve this? It really annoys me as I am so much a

Enable Vim Syntax Highlighting By Default

橙三吉。 提交于 2019-11-27 00:07:30
问题 I know how to turn syntax highlighting on and off in vim by running this in the editor: :syntax on/off But I want syntax highlighting to be enabled by default, so I don't have to turn it on every time I run vim. How do I do this? 回答1: Edit your $HOME/.vimrc (Unix/Linux/OSX) or $HOME/_vimrc (Windows) to include the following line: syntax on EDIT If your syntax highlighting doesn't work when you start Vim, you probably don't have a $HOME/.vimrc or $HOME/_vimrc (known collectively as vimrc from

class & function names highlighting in Vim

风格不统一 提交于 2019-11-26 12:34:52
问题 I just recently set up my Vim environment from Textmate, after becoming addicted to its modal input. However, syntax highlighting seems to be not so beautiful in Vim. I code in C++ and since the function call and class names can\'t be highlighted, the code is more difficult to read. I played with color scheme for a bit, but couldn\'t find any field that corresponded to \"class name\" or \"function name\". In the picture below, notice how DroughtLayer:: and *.size() is not highlighted on the