Saturday, March 23, 2013

configuring color property for highlight group

First of all to know how to get started with grouping and coloring that particular group read Previous Page.

You can change colors with :colorscheme command. This loads your gvim opened file wiht :highlight command as following.
                   :hi comment gui=bold
In this command all setting will not change only specified field will change and this settings are merged with old one. So after this command your result for color scheme setting for group comment will merge with existing setting only parameter gui becomes bold. When listing a highlight group and 'verbose' is non-zero, the listing will also display where it was last set. Example:
            :verbose hi Comment 
             Comment xxx term=bold ctermfg=4 guifg=Blue
               Last set from /home/mool/vim/vim7/runtime/syntax/syncolor.vim
When ":hi clear" is used then the script where this command is used will be mentioned for the default values.As above color property of group contains variables like term, ctermfg, guifg etc. We will discuss them.

 term/cterm/gui

     bold
  underline
undercurl not always available reverse inverse same as reverse italic standout NONE no attributes used (used to reset it)


you can set any property for your defined group for highlighting purpose.


ctermfg/ctermbg/guifg/guibg/guisp

This all variable has popular color value is as follow. It color name might change according to operating system and gvim version you are using.
     Red         LightRed        DarkRed
     Green       LightGreen      DarkGreen       SeaGreen
     Blue        LightBlue       DarkBlue        SlateBlue
     Cyan        LightCyan       DarkCyan
     Magenta     LightMagenta    DarkMagenta
     Yellow      LightYellow     Brown          DarkYellow
     Gray        LightGray       DarkGray
     Black       White
     Orange      Purple         Violet

you can see which variables are used for configuration of your gvim file highlighting by displaying property of any existing group.
Here I have given one example for creating group and assigning some particular value to that group.

                         :syntax keyword room sandip hitesh brijesh
by this command group will be created with name room. now using following command you can give your defined group a color property you want to give.
                          :hi room term=bold  gui=bold guifg=red 

If you are coding in suppose x programming language there must be a string in that. And string is always highlighted with different color which is in double inverted comma. For example "gvim and vim editor" . Now you might be thinking how to isolate word in string and normal word. Gvim/Vim has facility to identify those type of pasterns. That I have given in next blog that how to define complex group for highlighting in gvim/vim.



PREV PAGE INDEX NEXT PAGE


No comments:

Post a Comment