usr_06 Using syntax highlighting
06.1 Switching it on
:syntax enable
if &t_Co > 1
syntax enable
endif
06.2 No or wrong colors?
- Your terminal does not support colors.
- Your terminal does support colors, but Vim doesn’t know this.
TERM=xterm-color; export TERM
- The file type is not recognized.
:set filetype
:set filetype=fortran
- There is no highlighting for your file type.
you can write your own syntax file.
Or the colors could be wrong: - The colored text is very hard to read.
:set background=dark
:set background=light
- The colors are wrong when scrolling bottom to top.
06.3 Different colors
:colorscheme evening
You could also write your own color scheme.
06.4 With colors or without colors
:syntax clear
:syntax off
:syntax manual
:set syntax=ON
06.5 Printing with colors
Convert the current file to HTML with this command:
:TOhtml
06.6 Further reading
usr_44.txt Your own syntax highlighted.
syntax All the details.