neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

syntax.vim (1454B)


      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 
      9 if !has("syntax")
     10  finish
     11 endif
     12 
     13 " If Syntax highlighting appears to be on already, turn it off first, so that
     14 " any leftovers are cleared.
     15 if exists("syntax_on") || exists("syntax_manual")
     16  so <sfile>:p:h/nosyntax.vim
     17 endif
     18 
     19 " Load the Syntax autocommands and set the default methods for highlighting.
     20 runtime syntax/synload.vim
     21 
     22 " Load the FileType autocommands if not done yet.
     23 if exists("did_load_filetypes")
     24  let s:did_ft = 1
     25 else
     26  filetype on
     27  let s:did_ft = 0
     28 endif
     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.
     34 augroup syntaxset
     35  au! FileType *	if !exists('b:ts_highlight') | 0verbose exe "set syntax=" . expand("<amatch>") | endif
     36 augroup 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).
     42 doautoall syntaxset FileType
     43 if !s:did_ft
     44  doautoall filetypedetect BufRead
     45 endif