vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

synload.vim (2130B)


      1 " Vim syntax support file
      2 " Maintainer:	The Vim Project <https://github.com/vim/vim>
      3 " Last Change:	2026 Sep 11
      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 " Set the default highlighting colors.  Use a color scheme if specified.
     19 if exists("colors_name")
     20   exe "colors " . colors_name
     21 else
     22   runtime! syntax/syncolor.vim
     23 endif
     24 
     25 " Line continuation is used here, remove 'C' from 'cpoptions'
     26 let s:cpo_save = &cpo
     27 set cpo&vim
     28 
     29 " First remove all old syntax autocommands.
     30 au! Syntax
     31 
     32 au Syntax *		call s:SynSet()
     33 
     34 fun! s:SynSet()
     35   " clear syntax for :set syntax=OFF  and any syntax name that doesn't exist
     36   syn clear
     37   if exists("b:current_syntax")
     38     unlet b:current_syntax
     39   endif
     40 
     41   0verbose let s = expand("<amatch>")
     42   if s == "ON"
     43     " :set syntax=ON
     44     if &filetype == ""
     45       echohl ErrorMsg
     46       echo "filetype unknown"
     47       echohl None
     48     endif
     49     let s = &filetype
     50   elseif s == "OFF"
     51     let s = ""
     52   endif
     53 
     54   if s != ""
     55     " Load the syntax file(s).  When there are several, separated by dots,
     56     " load each in sequence.  Skip empty entries.
     57     for name in split(s, '\.')
     58       if !empty(name) && name !=# 'syntax'
     59 	exe "runtime! syntax/" . name . ".vim syntax/" . name . "/*.vim"
     60       endif
     61     endfor
     62   endif
     63 endfun
     64 
     65 
     66 " Handle adding doxygen to other languages (C, C++, C#, IDL, java, php, DataScript)
     67 au Syntax c,cpp,cs,idl,java,php,datascript
     68 	\ if (exists('b:load_doxygen_syntax') && b:load_doxygen_syntax)
     69 	\	|| (exists('g:load_doxygen_syntax') && g:load_doxygen_syntax)
     70 	\   | runtime! syntax/doxygen.vim
     71 	\ | endif
     72 
     73 
     74 " Source the user-specified syntax highlighting file
     75 if exists("mysyntaxfile")
     76   let s:fname = expand(mysyntaxfile)
     77   if filereadable(s:fname)
     78     execute "source " . fnameescape(s:fname)
     79   endif
     80 endif
     81 
     82 " Restore 'cpoptions'
     83 let &cpo = s:cpo_save
     84 unlet s:cpo_save