annotate runtime/syntax/synload.vim @ 164:8b0ee9d57d7f

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