annotate runtime/syntax/syntax.vim @ 21233:7f90d64e0982

Added tag v8.2.1167 for changeset 3f14e0d4a4dd08d91b5ca9e0410d8a1ed8b30ee2
author Bram Moolenaar <Bram@vim.org>
date Thu, 09 Jul 2020 21:30:04 +0200
parents 3fc0f57ecb91
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>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 " Last Change: 2001 Sep 04
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 " This file is used for ":syntax on".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 " It installs the autocommands and starts highlighting for all buffers.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 if !has("syntax")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 " If Syntax highlighting appears to be on already, turn it off first, so that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 " any leftovers are cleared.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 if exists("syntax_on") || exists("syntax_manual")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 so <sfile>:p:h/nosyntax.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 " Load the Syntax autocommands and set the default methods for highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 runtime syntax/synload.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 " Load the FileType autocommands if not done yet.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 if exists("did_load_filetypes")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 let s:did_ft = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 filetype on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 let s:did_ft = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 " Set up the connection between FileType and Syntax autocommands.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 " This makes the syntax automatically set when the file type is detected.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 augroup syntaxset
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 au! FileType * exe "set syntax=" . expand("<amatch>")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 augroup END
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 " Execute the syntax autocommands for the each buffer.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 " If the filetype wasn't detected yet, do that now.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 " Always do the syntaxset autocommands, for buffers where the 'filetype'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 " already was set manually (e.g., help buffers).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 doautoall syntaxset FileType
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 if !s:did_ft
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 doautoall filetypedetect BufRead
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 endif