robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Sean Dewarvim-patch:e978b4534a5e (#24697)cbf54ec2a5

master
1.4 KiB45 linesraw
1" Vim syntax support file
2" Maintainer:	The Vim Project <https://github.com/vim/vim>
3" Last Change:	2023 Aug 10
4" Former Maintainer:	Bram Moolenaar <Bram@vim.org>
5
6" This file is used for ":syntax on".
7" It installs the autocommands and starts highlighting for all buffers.
8
9if !has("syntax")
10  finish
11endif
12
13" If Syntax highlighting appears to be on already, turn it off first, so that
14" any leftovers are cleared.
15if exists("syntax_on") || exists("syntax_manual")
16  so <sfile>:p:h/nosyntax.vim
17endif
18
19" Load the Syntax autocommands and set the default methods for highlighting.
20runtime syntax/synload.vim
21
22" Load the FileType autocommands if not done yet.
23if exists("did_load_filetypes")
24  let s:did_ft = 1
25else
26  filetype on
27  let s:did_ft = 0
28endif
29
30" Set up the connection between FileType and Syntax autocommands.
31" This makes the syntax automatically set when the file type is detected
32" unless treesitter highlighting is enabled.
33" Avoid an error when 'verbose' is set and <amatch> expansion fails.
34augroup syntaxset
35  au! FileType *	if !exists('b:ts_highlight') | 0verbose exe "set syntax=" . expand("<amatch>") | endif
36augroup END
37
38" Execute the syntax autocommands for the each buffer.
39" If the filetype wasn't detected yet, do that now.
40" Always do the syntaxset autocommands, for buffers where the 'filetype'
41" already was set manually (e.g., help buffers).
42doautoall syntaxset FileType
43if !s:did_ft
44  doautoall filetypedetect BufRead
45endif