Vim Syntax Highlighting

From UCLUG
Jump to: navigation, search

Syntax Highlighting

What it is

  • indicating syntax of language via coloring, font altering, etc

How to activate in Vim

  • Just Works option
  • Doesn't work option
    • verify Vim compiled with +syntax
      • :version
      • vim --version or gvim --version
      • if not, check if package is vim-minimal; get vim-enhanced
    • file type not correctly detected
      • Check: :set filetype
      • Change: :se ft=c

What syntaxes supported?

  • Look in Vim syntax directory (eg, /usr/share/vim/vim72/syntax/)

Other info

:syntax 
shows what matches
:highlight 
shows color scheme
:set background 
changes contrast based on terminal, alters color scheme slightly
:hardcopy 
creates printout
:TOhtml 
if :ha doesn't work, launch in web browser, then print

Demo