Wikia

Vim Tips Wiki

Changes: User:Donald j axel/syncolor

Edit

Back to page

(Move in some comments from Highlighting.)
Line 1: Line 1:
" Vim syntax support file
+
Vim 7.3 is distributed with file <tt>vim73/syntax/syncolor.vim</tt>. The following is an example of how that file might be changed. These comments were originally posted at [[Changing the default syntax highlighting]], and the comments were then moved to [[Highlighting]], and then moved to here.
" Maintainer: Bram Moolenaar <Bram@vim.org>
+
----
" Change: 2001 Sep 12
+
I want a simple syntax highlighting which does not take attention from the real thing. Color
" Changed again by Donald Axel <donald_j_axel@yahoo.com>
+
codes are:
" dax:ca.2004 and uploaded 2009-11-12
+
:Green for comments
+
:Blue for keywords/types
" This file sets up the default methods for highlighting.
+
:Bluebold for flow-control
" It is loaded from "synload.vim" and from Vim for ":syntax reset".
+
:Brown or gray for strings and constants
" Also used from init_highlight().
+
:Black (or navy) for the rest
+
if !exists("syntax_cmd") || syntax_cmd == "on"
+
For that purpose I changed the "syncolor.vim" file (and it works best for light background xterm).
" ":syntax on" works like in Vim 5.7: set colors but keep links
+
command -nargs=* SynColor hi <args>
+
Some changes are:
command -nargs=* SynLink hi link <args>
+
<pre>
else
+
SynColor Comment term=bold cterm=NONE ctermfg=DarkGreen ctermbg=NONE gui=NONE guifg=MediumSeaGreen guibg=NONE
if syntax_cmd == "enable"
+
SynColor Constant term=underline cterm=NONE ctermfg=DarkRed ctermbg=NONE gui=NONE guifg=SlateGrey guibg=NONE
" ":syntax enable" keeps any existing colors
+
SynColor Special term=bold cterm=NONE ctermfg=DarkRed ctermbg=NONE gui=NONE guifg=DarkRed guibg=NONE
command -nargs=* SynColor hi def <args>
+
SynColor Identifier term=underline cterm=NONE ctermfg=DarkCyan ctermbg=NONE gui=NONE guifg=DarkCyan guibg=NONE
command -nargs=* SynLink hi def link <args>
+
SynColor Statement term=bold cterm=NONE ctermfg=Blue ctermbg=NONE gui=bold guifg=SlateBlue guibg=NONE
elseif syntax_cmd == "reset"
+
SynColor PreProc term=underline cterm=NONE ctermfg=DarkBlue ctermbg=NONE gui=NONE guifg=SlateBlue guibg=NONE
" ":syntax reset" resets all colors to the default
+
SynColor Type term=underline cterm=NONE ctermfg=DarkBlue ctermbg=NONE gui=bold guifg=Blue guibg=NONE
command -nargs=* SynColor hi <args>
+
SynColor Underlined term=underline cterm=underline ctermfg=DarkMagenta gui=underline guifg=SlateBlue
command -nargs=* SynLink hi! link <args>
+
SynColor Ignore term=NONE cterm=NONE ctermfg=white ctermbg=NONE gui=NONE guifg=bg guibg=NONE
else
+
</pre>
" User defined syncolor file has already set the colors.
+
finish
+
The changed syncolor.vim file follows.
endif
+
<pre>
endif
+
" Vim syntax support file
+
" Maintainer: Bram Moolenaar <Bram --at-- vim.org>
" Many terminals can only use six different colors (plus black and white).
+
" Change: 2001 Sep 12
" Therefore the number of colors used is kept low. It doesn't look nice with
+
" Changed again by Donald Axel <donald_j_axel --at-- yahoo.com>
" too many colors anyway.
+
" dax:ca.2004 and uploaded 2009-11-12
" Careful with "cterm=bold", it changes the color to bright for some terminals.
+
" There are two sets of defaults: for a dark and a light background.
+
" This file sets up the default methods for highlighting.
if &background == "dark"
+
" It is loaded from "synload.vim" and from Vim for ":syntax reset".
SynColor Comment term=bold cterm=NONE ctermfg=DarkGreen ctermbg=NONE gui=NONE guifg=#80a0ff guibg=NONE
+
" Also used from init_highlight().
SynColor Constant term=underline cterm=NONE ctermfg=DarkRed ctermbg=NONE gui=NONE guifg=slategrey guibg=NONE
+
SynColor Special term=bold cterm=NONE ctermfg=DarkRed ctermbg=NONE gui=NONE guifg=Orange guibg=NONE
+
if !exists("syntax_cmd") || syntax_cmd == "on"
SynColor Identifier term=underline cterm=bold ctermfg=NONE ctermbg=NONE gui=NONE guifg=#40ffff guibg=NONE
+
" ":syntax on" works like in Vim 5.7: set colors but keep links
SynColor Statement term=bold cterm=NONE ctermfg=white ctermbg=NONE gui=bold guifg=#ffff60 guibg=NONE
+
command -nargs=* SynColor hi <args>
SynColor PreProc term=underline cterm=NONE ctermfg=LightBlue ctermbg=NONE gui=NONE guifg=#ff80ff guibg=NONE
+
command -nargs=* SynLink hi link <args>
SynColor Type term=underline cterm=NONE ctermfg=LightBlue ctermbg=NONE gui=bold guifg=#60ff60 guibg=NONE
+
else
SynColor Underlined term=underline cterm=underline ctermfg=LightBlue gui=underline guifg=#80a0ff
+
if syntax_cmd == "enable"
SynColor Ignore term=NONE cterm=NONE ctermfg=black ctermbg=NONE gui=NONE guifg=bg guibg=NONE
+
" ":syntax enable" keeps any existing colors
else
+
command -nargs=* SynColor hi def <args>
SynColor Comment term=bold cterm=NONE ctermfg=DarkGreen ctermbg=NONE gui=NONE guifg=MediumSeaGreen guibg=NONE
+
command -nargs=* SynLink hi def link <args>
SynColor Constant term=underline cterm=NONE ctermfg=DarkRed ctermbg=NONE gui=NONE guifg=SlateGrey guibg=NONE
+
elseif syntax_cmd == "reset"
SynColor Special term=bold cterm=NONE ctermfg=DarkRed ctermbg=NONE gui=NONE guifg=DarkRed guibg=NONE
+
" ":syntax reset" resets all colors to the default
SynColor Identifier term=underline cterm=NONE ctermfg=DarkCyan ctermbg=NONE gui=NONE guifg=DarkCyan guibg=NONE
+
command -nargs=* SynColor hi <args>
SynColor Statement term=bold cterm=NONE ctermfg=Blue ctermbg=NONE gui=bold guifg=SlateBlue guibg=NONE
+
command -nargs=* SynLink hi! link <args>
SynColor PreProc term=underline cterm=NONE ctermfg=DarkBlue ctermbg=NONE gui=NONE guifg=SlateBlue guibg=NONE
+
else
SynColor Type term=underline cterm=NONE ctermfg=DarkBlue ctermbg=NONE gui=bold guifg=Blue guibg=NONE
+
" User defined syncolor file has already set the colors.
SynColor Underlined term=underline cterm=underline ctermfg=DarkMagenta gui=underline guifg=SlateBlue
+
finish
SynColor Ignore term=NONE cterm=NONE ctermfg=white ctermbg=NONE gui=NONE guifg=bg guibg=NONE
+
endif
endif
+
endif
SynColor Error term=reverse cterm=NONE ctermfg=White ctermbg=Red gui=NONE guifg=White guibg=Red
+
SynColor Todo term=standout cterm=NONE ctermfg=Black ctermbg=Yellow gui=NONE guifg=Blue guibg=Yellow
+
" Many terminals can only use six different colors (plus black and white).
+
" Therefore the number of colors used is kept low. It doesn't look nice with
" Common groups that link to default highlighting.
+
" too many colors anyway.
" You can specify other highlighting easily.
+
" Careful with "cterm=bold", it changes the color to bright for some terminals.
SynLink String Constant
+
" There are two sets of defaults: for a dark and a light background.
SynLink Character Constant
+
if &background == "dark"
SynLink Number Constant
+
SynColor Comment term=bold cterm=NONE ctermfg=DarkGreen ctermbg=NONE gui=NONE guifg=#80a0ff guibg=NONE
SynLink Boolean Constant
+
SynColor Constant term=underline cterm=NONE ctermfg=DarkRed ctermbg=NONE gui=NONE guifg=slategrey guibg=NONE
SynLink Float Number
+
SynColor Special term=bold cterm=NONE ctermfg=DarkRed ctermbg=NONE gui=NONE guifg=Orange guibg=NONE
SynLink Function Identifier
+
SynColor Identifier term=underline cterm=bold ctermfg=NONE ctermbg=NONE gui=NONE guifg=#40ffff guibg=NONE
SynLink Conditional Statement
+
SynColor Statement term=bold cterm=NONE ctermfg=white ctermbg=NONE gui=bold guifg=#ffff60 guibg=NONE
SynLink Repeat Statement
+
SynColor PreProc term=underline cterm=NONE ctermfg=LightBlue ctermbg=NONE gui=NONE guifg=#ff80ff guibg=NONE
SynLink Label Statement
+
SynColor Type term=underline cterm=NONE ctermfg=LightBlue ctermbg=NONE gui=bold guifg=#60ff60 guibg=NONE
SynLink Operator Statement
+
SynColor Underlined term=underline cterm=underline ctermfg=LightBlue gui=underline guifg=#80a0ff
SynLink Keyword Statement
+
SynColor Ignore term=NONE cterm=NONE ctermfg=black ctermbg=NONE gui=NONE guifg=bg guibg=NONE
SynLink Exception Statement
+
else
SynLink Include PreProc
+
SynColor Comment term=bold cterm=NONE ctermfg=DarkGreen ctermbg=NONE gui=NONE guifg=MediumSeaGreen guibg=NONE
SynLink Define PreProc
+
SynColor Constant term=underline cterm=NONE ctermfg=DarkRed ctermbg=NONE gui=NONE guifg=SlateGrey guibg=NONE
SynLink Macro PreProc
+
SynColor Special term=bold cterm=NONE ctermfg=DarkRed ctermbg=NONE gui=NONE guifg=DarkRed guibg=NONE
SynLink PreCondit PreProc
+
SynColor Identifier term=underline cterm=NONE ctermfg=DarkCyan ctermbg=NONE gui=NONE guifg=DarkCyan guibg=NONE
SynLink StorageClass Type
+
SynColor Statement term=bold cterm=NONE ctermfg=Blue ctermbg=NONE gui=bold guifg=SlateBlue guibg=NONE
SynLink Structure Type
+
SynColor PreProc term=underline cterm=NONE ctermfg=DarkBlue ctermbg=NONE gui=NONE guifg=SlateBlue guibg=NONE
SynLink Typedef Type
+
SynColor Type term=underline cterm=NONE ctermfg=DarkBlue ctermbg=NONE gui=bold guifg=Blue guibg=NONE
SynLink Tag Special
+
SynColor Underlined term=underline cterm=underline ctermfg=DarkMagenta gui=underline guifg=SlateBlue
SynLink SpecialChar Special
+
SynColor Ignore term=NONE cterm=NONE ctermfg=white ctermbg=NONE gui=NONE guifg=bg guibg=NONE
SynLink Delimiter Special
+
endif
SynLink SpecialComment Special
+
SynColor Error term=reverse cterm=NONE ctermfg=White ctermbg=Red gui=NONE guifg=White guibg=Red
SynLink Debug Special
+
SynColor Todo term=standout cterm=NONE ctermfg=Black ctermbg=Yellow gui=NONE guifg=Blue guibg=Yellow
+
delcommand SynColor
+
" Common groups that link to default highlighting.
delcommand SynLink
+
" You can specify other highlighting easily.
  +
SynLink String Constant
  +
SynLink Character Constant
  +
SynLink Number Constant
  +
SynLink Boolean Constant
  +
SynLink Float Number
  +
SynLink Function Identifier
  +
SynLink Conditional Statement
  +
SynLink Repeat Statement
  +
SynLink Label Statement
  +
SynLink Operator Statement
  +
SynLink Keyword Statement
  +
SynLink Exception Statement
  +
SynLink Include PreProc
  +
SynLink Define PreProc
  +
SynLink Macro PreProc
  +
SynLink PreCondit PreProc
  +
SynLink StorageClass Type
  +
SynLink Structure Type
  +
SynLink Typedef Type
  +
SynLink Tag Special
  +
SynLink SpecialChar Special
  +
SynLink Delimiter Special
  +
SynLink SpecialComment Special
  +
SynLink Debug Special
  +
  +
delcommand SynColor
  +
delcommand SynLink
  +
</pre>

Revision as of 08:37, April 5, 2012

Vim 7.3 is distributed with file vim73/syntax/syncolor.vim. The following is an example of how that file might be changed. These comments were originally posted at Changing the default syntax highlighting, and the comments were then moved to Highlighting, and then moved to here.


I want a simple syntax highlighting which does not take attention from the real thing. Color codes are:

Green for comments
Blue for keywords/types
Bluebold for flow-control
Brown or gray for strings and constants
Black (or navy) for the rest

For that purpose I changed the "syncolor.vim" file (and it works best for light background xterm).

Some changes are:

SynColor Comment      term=bold      cterm=NONE ctermfg=DarkGreen ctermbg=NONE gui=NONE guifg=MediumSeaGreen guibg=NONE
SynColor Constant     term=underline cterm=NONE ctermfg=DarkRed   ctermbg=NONE gui=NONE guifg=SlateGrey guibg=NONE
SynColor Special      term=bold      cterm=NONE ctermfg=DarkRed   ctermbg=NONE gui=NONE guifg=DarkRed   guibg=NONE
SynColor Identifier   term=underline cterm=NONE ctermfg=DarkCyan  ctermbg=NONE gui=NONE guifg=DarkCyan  guibg=NONE
SynColor Statement    term=bold      cterm=NONE ctermfg=Blue      ctermbg=NONE gui=bold guifg=SlateBlue guibg=NONE
SynColor PreProc      term=underline cterm=NONE ctermfg=DarkBlue  ctermbg=NONE gui=NONE guifg=SlateBlue guibg=NONE
SynColor Type         term=underline cterm=NONE ctermfg=DarkBlue  ctermbg=NONE gui=bold guifg=Blue      guibg=NONE
SynColor Underlined   term=underline cterm=underline ctermfg=DarkMagenta gui=underline  guifg=SlateBlue
SynColor Ignore       term=NONE      cterm=NONE ctermfg=white     ctermbg=NONE gui=NONE guifg=bg        guibg=NONE

The changed syncolor.vim file follows.

" Vim syntax support file
" Maintainer:   Bram Moolenaar <Bram --at-- vim.org>
" Change:  2001 Sep 12
" Changed again by Donald Axel <donald_j_axel --at-- yahoo.com>
" dax:ca.2004 and uploaded 2009-11-12

" This file sets up the default methods for highlighting.
" It is loaded from "synload.vim" and from Vim for ":syntax reset".
" Also used from init_highlight().

if !exists("syntax_cmd") || syntax_cmd == "on"
  " ":syntax on" works like in Vim 5.7: set colors but keep links
  command -nargs=* SynColor hi <args>
  command -nargs=* SynLink hi link <args>
else
  if syntax_cmd == "enable"
    " ":syntax enable" keeps any existing colors
    command -nargs=* SynColor hi def <args>
    command -nargs=* SynLink hi def link <args>
  elseif syntax_cmd == "reset"
    " ":syntax reset" resets all colors to the default
    command -nargs=* SynColor hi <args>
    command -nargs=* SynLink hi! link <args>
  else
    " User defined syncolor file has already set the colors.
    finish
  endif
endif

" Many terminals can only use six different colors (plus black and white).
" Therefore the number of colors used is kept low. It doesn't look nice with
" too many colors anyway.
" Careful with "cterm=bold", it changes the color to bright for some terminals.
" There are two sets of defaults: for a dark and a light background.
if &background == "dark"
 SynColor  Comment     term=bold      cterm=NONE ctermfg=DarkGreen ctermbg=NONE   gui=NONE       guifg=#80a0ff   guibg=NONE
 SynColor  Constant    term=underline cterm=NONE ctermfg=DarkRed   ctermbg=NONE   gui=NONE       guifg=slategrey  guibg=NONE
 SynColor  Special     term=bold      cterm=NONE ctermfg=DarkRed   ctermbg=NONE   gui=NONE       guifg=Orange     guibg=NONE
 SynColor  Identifier  term=underline cterm=bold ctermfg=NONE      ctermbg=NONE   gui=NONE       guifg=#40ffff    guibg=NONE
 SynColor  Statement   term=bold      cterm=NONE ctermfg=white     ctermbg=NONE   gui=bold       guifg=#ffff60    guibg=NONE
 SynColor  PreProc     term=underline cterm=NONE ctermfg=LightBlue ctermbg=NONE   gui=NONE       guifg=#ff80ff    guibg=NONE
 SynColor  Type        term=underline cterm=NONE ctermfg=LightBlue ctermbg=NONE   gui=bold       guifg=#60ff60    guibg=NONE
 SynColor  Underlined  term=underline cterm=underline  ctermfg=LightBlue          gui=underline  guifg=#80a0ff
 SynColor  Ignore      term=NONE      cterm=NONE ctermfg=black     ctermbg=NONE   gui=NONE       guifg=bg         guibg=NONE
else
 SynColor Comment      term=bold      cterm=NONE ctermfg=DarkGreen ctermbg=NONE gui=NONE guifg=MediumSeaGreen guibg=NONE
 SynColor Constant     term=underline cterm=NONE ctermfg=DarkRed   ctermbg=NONE gui=NONE guifg=SlateGrey guibg=NONE
 SynColor Special      term=bold      cterm=NONE ctermfg=DarkRed   ctermbg=NONE gui=NONE guifg=DarkRed   guibg=NONE
 SynColor Identifier   term=underline cterm=NONE ctermfg=DarkCyan  ctermbg=NONE gui=NONE guifg=DarkCyan  guibg=NONE
 SynColor Statement    term=bold      cterm=NONE ctermfg=Blue      ctermbg=NONE gui=bold guifg=SlateBlue guibg=NONE
 SynColor PreProc      term=underline cterm=NONE ctermfg=DarkBlue  ctermbg=NONE gui=NONE guifg=SlateBlue guibg=NONE
 SynColor Type         term=underline cterm=NONE ctermfg=DarkBlue  ctermbg=NONE gui=bold guifg=Blue      guibg=NONE
 SynColor Underlined   term=underline cterm=underline ctermfg=DarkMagenta gui=underline  guifg=SlateBlue
 SynColor Ignore       term=NONE      cterm=NONE ctermfg=white     ctermbg=NONE gui=NONE guifg=bg        guibg=NONE
endif
SynColor Error          term=reverse cterm=NONE ctermfg=White ctermbg=Red gui=NONE guifg=White guibg=Red
SynColor Todo           term=standout cterm=NONE ctermfg=Black ctermbg=Yellow gui=NONE guifg=Blue guibg=Yellow

" Common groups that link to default highlighting.
" You can specify other highlighting easily.
SynLink String          Constant
SynLink Character       Constant
SynLink Number          Constant
SynLink Boolean         Constant
SynLink Float           Number
SynLink Function        Identifier
SynLink Conditional     Statement
SynLink Repeat          Statement
SynLink Label           Statement
SynLink Operator        Statement
SynLink Keyword         Statement
SynLink Exception       Statement
SynLink Include         PreProc
SynLink Define          PreProc
SynLink Macro           PreProc
SynLink PreCondit       PreProc
SynLink StorageClass    Type
SynLink Structure       Type
SynLink Typedef         Type
SynLink Tag             Special
SynLink SpecialChar     Special
SynLink Delimiter       Special
SynLink SpecialComment  Special
SynLink Debug           Special

delcommand SynColor
delcommand SynLink

Around Wikia's network

Random Wiki