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