annotate runtime/syntax/synload.vim @ 27:a01d8d9b2a58 first-working-version

first working version.
author kono
date Mon, 27 Oct 2008 18:28:11 +0900
parents 76efa0be13f1
children c16898406ff2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
1 " Vim syntax support file
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
2 " Maintainer: Bram Moolenaar <Bram@vim.org>
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
3 " Last Change: 2006 Apr 30
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
4
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
5 " This file sets up for syntax highlighting.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
6 " It is loaded from "syntax.vim" and "manual.vim".
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
7 " 1. Set the default highlight groups.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
8 " 2. Install Syntax autocommands for all the available syntax files.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
9
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
10 if !has("syntax")
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
11 finish
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
12 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
13
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
14 " let others know that syntax has been switched on
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
15 let syntax_on = 1
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
16
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
17 " Set the default highlighting colors. Use a color scheme if specified.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
18 if exists("colors_name")
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
19 exe "colors " . colors_name
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
20 else
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
21 runtime! syntax/syncolor.vim
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
22 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
23
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
24 " Line continuation is used here, remove 'C' from 'cpoptions'
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
25 let s:cpo_save = &cpo
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
26 set cpo&vim
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
27
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
28 " First remove all old syntax autocommands.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
29 au! Syntax
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
30
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
31 au Syntax * call s:SynSet()
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
32
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
33 fun! s:SynSet()
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
34 " clear syntax for :set syntax=OFF and any syntax name that doesn't exist
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
35 syn clear
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
36 if exists("b:current_syntax")
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
37 unlet b:current_syntax
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
38 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
39
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
40 let s = expand("<amatch>")
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
41 if s == "ON"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
42 " :set syntax=ON
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
43 if &filetype == ""
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
44 echohl ErrorMsg
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
45 echo "filetype unknown"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
46 echohl None
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
47 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
48 let s = &filetype
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
49 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
50
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
51 if s != ""
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
52 " Load the syntax file(s). When there are several, separated by dots,
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
53 " load each in sequence.
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
54 for name in split(s, '\.')
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
55 exe "runtime! syntax/" . name . ".vim syntax/" . name . "/*.vim"
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
56 endfor
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
57 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
58 endfun
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
59
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
60
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
61 " Handle adding doxygen to other languages (C, C++, IDL)
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
62 au Syntax cpp,c,idl
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
63 \ if (exists('b:load_doxygen_syntax') && b:load_doxygen_syntax)
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
64 \ || (exists('g:load_doxygen_syntax') && g:load_doxygen_syntax)
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
65 \ | runtime! syntax/doxygen.vim
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
66 \ | endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
67
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
68
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
69 " Source the user-specified syntax highlighting file
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
70 if exists("mysyntaxfile") && filereadable(expand(mysyntaxfile))
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
71 execute "source " . mysyntaxfile
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
72 endif
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
73
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
74 " Restore 'cpoptions'
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
75 let &cpo = s:cpo_save
76efa0be13f1 Initial revision
atsuki
parents:
diff changeset
76 unlet s:cpo_save