annotate runtime/syntax/synload.vim @ 9928:16a7dee7239c

Added tag v7.4.2237 for changeset e1a8b2601fe0f0971371bcae280920fbaae1d756
author Christian Brabandt <cb@256bit.org>
date Sun, 21 Aug 2016 19:15:06 +0200
parents 349e6c01f35d
children c78513465e6e
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>
3847
1003f9b262d7 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3356
diff changeset
3 " Last Change: 2012 Sep 25
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
3847
1003f9b262d7 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3356
diff changeset
49 elseif s == "OFF"
1003f9b262d7 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3356
diff changeset
50 let s = ""
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 if s != ""
782
d20041a02ee5 updated for version 7.0228
vimboss
parents: 164
diff changeset
54 " Load the syntax file(s). When there are several, separated by dots,
d20041a02ee5 updated for version 7.0228
vimboss
parents: 164
diff changeset
55 " load each in sequence.
d20041a02ee5 updated for version 7.0228
vimboss
parents: 164
diff changeset
56 for name in split(s, '\.')
d20041a02ee5 updated for version 7.0228
vimboss
parents: 164
diff changeset
57 exe "runtime! syntax/" . name . ".vim syntax/" . name . "/*.vim"
d20041a02ee5 updated for version 7.0228
vimboss
parents: 164
diff changeset
58 endfor
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 endfun
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62
7013
349e6c01f35d Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3847
diff changeset
63 " Handle adding doxygen to other languages (C, C++, C#, IDL, java, php, DataScript)
349e6c01f35d Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3847
diff changeset
64 au Syntax c,cpp,cs,idl,java,php,datascript
22
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
65 \ if (exists('b:load_doxygen_syntax') && b:load_doxygen_syntax)
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
66 \ || (exists('g:load_doxygen_syntax') && g:load_doxygen_syntax)
856
8cd729851562 updated for version 7.0g
vimboss
parents: 782
diff changeset
67 \ | runtime! syntax/doxygen.vim
22
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
68 \ | endif
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
69
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
70
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 " Source the user-specified syntax highlighting file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 if exists("mysyntaxfile") && filereadable(expand(mysyntaxfile))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 execute "source " . mysyntaxfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 " Restore 'cpoptions'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 let &cpo = s:cpo_save
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 unlet s:cpo_save