Now that you’ve seen a complete vim color command like this, as you might guess, the general version of the highlight command looks like this: Highlight Comment cterm=underline ctermbg=Blue ctermfg=White For instance, in addition to adding color to comments, if I want to underline them as well I can use this command: To take this one step further, you can also add some additional font attributes with the cterm keyword. This example shows demonstrates that you can specify both a foreground color (ctermfg) and a background color (ctermbg) with one command. Highlight Comment ctermbg=Blue ctermfg=White How to specify vim foreground and background colorsīefore we look at the general syntax of the vi highlight command, lets take a look at a slightly more complicated example: You’ll need this command to get your custom vi colors to work, so I thought I’d slip it in now so you can start experimenting with colors on your own system. Therefore, you need a way to specify these segments of code, and the “product” portion of the highlight command lets you specify these regions.īefore moving on to some more complicated examples, note that I included the syntax enable command at the end of that example. If you’re familiar with Java - or any other programming language - you’ll know that it consists of things like comments, constants, variables, and many more things. For instance, imagine you’re editing a Java file. " this next line is needed to enable your custom colors:īecause vim supports syntax highlighting, it makes sense that groups like these need to be specified. This highlight command can be read as “When using a color terminal (cterm), set the background terminal color (ctermbg) to Blue for the ‘Normal’ group.”Īt first blush the word “Normal” may not make much sense, but if I add in a few more groups, I think you’ll see the power of groups: Let’s look at a sample command to help us get rolling: The highlight commands are powerful, you need a little bit of background information to learn how to use them. The next thing to know is that you control the vim colors using a command named highlight. Either file will be located in your home directory on a Unix or Linux system. On older Unix systems the vi configuration file was named. You can control your vim color settings in your vim startup file. If you’re interested in choosing a vim color scheme, or figuring out which colorschemes are available on your system, please see my vi/vim color scheme (colorscheme) tutorial. Note: This tutorial is about how to manually configure vim color settings. In this article I'll try to demonstrate how you can change the colors in vim to be a little more pleasing, or at least be more in your control. When using vim syntax highlighting, a common complaint is that the default color scheme is a little too bold. Vim colors FAQ: Can you provide details on how to control/configure colors in the vim editor (i.e., vim color settings)?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |