Document directory
In fact, sequence Vim supports the addition of syntaxes in hundreds of languages. However, the addition of scripts based on syntaxes does not satisfy everyone. Sometimes we want to highlight some specific constants. However, the configuration is required.
Just like the OpenGL I recently learned, I want to enable the system constants and functions to be highlighted when I edit files (. c files. So next we will look at how to configure our syntax file.
Vim syntax brightening mechanism
The syntax of VIM is highlighted in two parts.
- Syntax unit matching: determines whether a character in a text is a comment or a constant or a string. After Vim has determined the syntax unit to be highlighted, it starts to use the specified highlighted file.
- Highlight files based on the highlighted Script: note that Vim is not specific to a specific file at this stage. If any type of file is highlighted, the constant type is highlighted in the same color. ,
Specific Configuration
The syntax file is in {echo $ Vim}/vim72/syntax by default. Note: Input echo $ Vim on the Vim command line to obtain the installation path of VIM on the system.
The color configuration file is in {echo $ Vim}/vim72/colors by default. Note: Input echo $ Vim on the Vim command line to obtain the installation path of VIM on the system.
To configure a color file of your own, you can first select a color template that is close to your own, and then modify it.
You can enter colorscheme \ t in the vim command line to check the effect of the color file that comes with the system. Note: Entering the tab key will display the existing color configuration file of the system. Move the cursor to highlight the selected configuration. Press enter to check the effect. If you have a nice color file. You can write the name of the selected color configuration file in. vimrc or. gvimrc, so that the selected color configuration will be automatically loaded every time you open vim. E.g. colorscheme Ron
(To be continued)