Mercurial > vim
annotate runtime/syntax/synload.vim @ 32262:854aeaac48b7 v9.0.1462
patch 9.0.1462: recursively calling :defer function if it does :qa
Commit: https://github.com/vim/vim/commit/42994bf678f46dc9ca66e49f512261da8864fff6
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Apr 17 19:23:45 2023 +0100
patch 9.0.1462: recursively calling :defer function if it does :qa
Problem: Recursively calling :defer function if it does :qa.
Solution: Clear the defer entry before calling the function. (closes https://github.com/vim/vim/issues/12266)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 17 Apr 2023 20:30:07 +0200 |
parents | f73a9bdff3a3 |
children | 4027cefc2aab |
rev | line source |
---|---|
7 | 1 " Vim syntax support file |
2 " Maintainer: Bram Moolenaar <Bram@vim.org> | |
28517 | 3 " Last Change: 2022 Apr 12 |
7 | 4 |
5 " This file sets up for syntax highlighting. | |
6 " It is loaded from "syntax.vim" and "manual.vim". | |
7 " 1. Set the default highlight groups. | |
8 " 2. Install Syntax autocommands for all the available syntax files. | |
9 | |
10 if !has("syntax") | |
11 finish | |
12 endif | |
13 | |
14 " let others know that syntax has been switched on | |
15 let syntax_on = 1 | |
16 | |
17 " Set the default highlighting colors. Use a color scheme if specified. | |
18 if exists("colors_name") | |
19 exe "colors " . colors_name | |
20 else | |
21 runtime! syntax/syncolor.vim | |
22 endif | |
23 | |
24 " Line continuation is used here, remove 'C' from 'cpoptions' | |
25 let s:cpo_save = &cpo | |
26 set cpo&vim | |
27 | |
28 " First remove all old syntax autocommands. | |
29 au! Syntax | |
30 | |
31 au Syntax * call s:SynSet() | |
32 | |
33 fun! s:SynSet() | |
34 " clear syntax for :set syntax=OFF and any syntax name that doesn't exist | |
35 syn clear | |
36 if exists("b:current_syntax") | |
37 unlet b:current_syntax | |
38 endif | |
39 | |
28433
367439b95aba
patch 8.2.4741: startup test fails
Bram Moolenaar <Bram@vim.org>
parents:
20115
diff
changeset
|
40 0verbose let s = expand("<amatch>") |
7 | 41 if s == "ON" |
42 " :set syntax=ON | |
43 if &filetype == "" | |
44 echohl ErrorMsg | |
45 echo "filetype unknown" | |
46 echohl None | |
47 endif | |
48 let s = &filetype | |
3847 | 49 elseif s == "OFF" |
50 let s = "" | |
7 | 51 endif |
52 | |
53 if s != "" | |
782 | 54 " Load the syntax file(s). When there are several, separated by dots, |
20115 | 55 " load each in sequence. Skip empty entries. |
782 | 56 for name in split(s, '\.') |
20115 | 57 if !empty(name) |
58 exe "runtime! syntax/" . name . ".vim syntax/" . name . "/*.vim" | |
59 endif | |
782 | 60 endfor |
7 | 61 endif |
62 endfun | |
63 | |
64 | |
7013 | 65 " Handle adding doxygen to other languages (C, C++, C#, IDL, java, php, DataScript) |
66 au Syntax c,cpp,cs,idl,java,php,datascript | |
22 | 67 \ if (exists('b:load_doxygen_syntax') && b:load_doxygen_syntax) |
68 \ || (exists('g:load_doxygen_syntax') && g:load_doxygen_syntax) | |
856 | 69 \ | runtime! syntax/doxygen.vim |
22 | 70 \ | endif |
71 | |
72 | |
7 | 73 " Source the user-specified syntax highlighting file |
10348
c78513465e6e
commit https://github.com/vim/vim/commit/25de4c232d580583feadae11ab34e3cc6333c350
Christian Brabandt <cb@256bit.org>
parents:
7013
diff
changeset
|
74 if exists("mysyntaxfile") |
c78513465e6e
commit https://github.com/vim/vim/commit/25de4c232d580583feadae11ab34e3cc6333c350
Christian Brabandt <cb@256bit.org>
parents:
7013
diff
changeset
|
75 let s:fname = expand(mysyntaxfile) |
c78513465e6e
commit https://github.com/vim/vim/commit/25de4c232d580583feadae11ab34e3cc6333c350
Christian Brabandt <cb@256bit.org>
parents:
7013
diff
changeset
|
76 if filereadable(s:fname) |
c78513465e6e
commit https://github.com/vim/vim/commit/25de4c232d580583feadae11ab34e3cc6333c350
Christian Brabandt <cb@256bit.org>
parents:
7013
diff
changeset
|
77 execute "source " . fnameescape(s:fname) |
c78513465e6e
commit https://github.com/vim/vim/commit/25de4c232d580583feadae11ab34e3cc6333c350
Christian Brabandt <cb@256bit.org>
parents:
7013
diff
changeset
|
78 endif |
7 | 79 endif |
80 | |
81 " Restore 'cpoptions' | |
82 let &cpo = s:cpo_save | |
83 unlet s:cpo_save |