annotate runtime/syntax/synload.vim @ 22662:0f6e0cc4e927

Added tag v8.2.1879 for changeset c6b17787a38f9c6275cf9934f67abce7fb83427e
author Bram Moolenaar <Bram@vim.org>
date Wed, 21 Oct 2020 16:45:04 +0200
parents bd021eb62e73
children 367439b95aba
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>
20115
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 10348
diff changeset
3 " Last Change: 2020 Apr 13
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,
20115
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 10348
diff changeset
55 " load each in sequence. Skip empty entries.
782
d20041a02ee5 updated for version 7.0228
vimboss
parents: 164
diff changeset
56 for name in split(s, '\.')
20115
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 10348
diff changeset
57 if !empty(name)
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 10348
diff changeset
58 exe "runtime! syntax/" . name . ".vim syntax/" . name . "/*.vim"
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 10348
diff changeset
59 endif
782
d20041a02ee5 updated for version 7.0228
vimboss
parents: 164
diff changeset
60 endfor
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 endfun
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64
7013
349e6c01f35d Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3847
diff changeset
65 " 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
66 au Syntax c,cpp,cs,idl,java,php,datascript
22
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
67 \ if (exists('b:load_doxygen_syntax') && b:load_doxygen_syntax)
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
68 \ || (exists('g:load_doxygen_syntax') && g:load_doxygen_syntax)
856
8cd729851562 updated for version 7.0g
vimboss
parents: 782
diff changeset
69 \ | runtime! syntax/doxygen.vim
22
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
70 \ | endif
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
71
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
72
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 " Source the user-specified syntax highlighting file
10348
c78513465e6e commit https://github.com/vim/vim/commit/25de4c232d580583feadae11ab34e3cc6333c350
Christian Brabandt <cb@256bit.org>
parents: 7013
diff changeset
74 if exists("mysyntaxfile")
c78513465e6e commit https://github.com/vim/vim/commit/25de4c232d580583feadae11ab34e3cc6333c350
Christian Brabandt <cb@256bit.org>
parents: 7013
diff changeset
75 let s:fname = expand(mysyntaxfile)
c78513465e6e commit https://github.com/vim/vim/commit/25de4c232d580583feadae11ab34e3cc6333c350
Christian Brabandt <cb@256bit.org>
parents: 7013
diff changeset
76 if filereadable(s:fname)
c78513465e6e commit https://github.com/vim/vim/commit/25de4c232d580583feadae11ab34e3cc6333c350
Christian Brabandt <cb@256bit.org>
parents: 7013
diff changeset
77 execute "source " . fnameescape(s:fname)
c78513465e6e commit https://github.com/vim/vim/commit/25de4c232d580583feadae11ab34e3cc6333c350
Christian Brabandt <cb@256bit.org>
parents: 7013
diff changeset
78 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 " Restore 'cpoptions'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 let &cpo = s:cpo_save
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 unlet s:cpo_save