neovim

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

synload.vim (2025B)


      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 sets up for syntax highlighting.
      7 " It is loaded from "syntax.vim" and "manual.vim".
      8 " 1. Set the default highlight groups.
      9 " 2. Install Syntax autocommands for all the available syntax files.
     10 
     11 if !has("syntax")
     12  finish
     13 endif
     14 
     15 " let others know that syntax has been switched on
     16 let syntax_on = 1
     17 
     18 " Line continuation is used here, remove 'C' from 'cpoptions'
     19 let s:cpo_save = &cpo
     20 set cpo&vim
     21 
     22 " First remove all old syntax autocommands.
     23 au! Syntax
     24 
     25 au Syntax *		call s:SynSet()
     26 
     27 fun! s:SynSet()
     28  " clear syntax for :set syntax=OFF  and any syntax name that doesn't exist
     29  syn clear
     30  if exists("b:current_syntax")
     31    unlet b:current_syntax
     32  endif
     33 
     34  0verbose let s = expand("<amatch>")
     35  if s == "ON"
     36    " :set syntax=ON
     37    if &filetype == ""
     38      echohl ErrorMsg
     39      echo "filetype unknown"
     40      echohl None
     41    endif
     42    let s = &filetype
     43  elseif s == "OFF"
     44    let s = ""
     45  endif
     46 
     47  if s != ""
     48    " Load the syntax file(s).  When there are several, separated by dots,
     49    " load each in sequence.  Skip empty entries.
     50    for name in split(s, '\.')
     51      if !empty(name)
     52        " XXX: "[.]" in the first pattern makes it a wildcard on Windows
     53        exe $'runtime! syntax/{name}[.]{{vim,lua}} syntax/{name}/*.{{vim,lua}}'
     54      endif
     55    endfor
     56  endif
     57 endfun
     58 
     59 
     60 " Handle adding doxygen to other languages (C, C++, C#, IDL, java, php, DataScript)
     61 au Syntax c,cpp,cs,idl,java,php,datascript
     62 \ if (exists('b:load_doxygen_syntax') && b:load_doxygen_syntax)
     63 \	|| (exists('g:load_doxygen_syntax') && g:load_doxygen_syntax)
     64 \   | runtime! syntax/doxygen.vim
     65 \ | endif
     66 
     67 
     68 " Source the user-specified syntax highlighting file
     69 if exists("mysyntaxfile")
     70  let s:fname = expand(mysyntaxfile)
     71  if filereadable(s:fname)
     72    execute "source " . fnameescape(s:fname)
     73  endif
     74 endif
     75 
     76 " Restore 'cpoptions'
     77 let &cpo = s:cpo_save
     78 unlet s:cpo_save