Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax support file |
Christian Brabandt | e978b45 | 2023-08-13 10:33:05 +0200 | [diff] [blame] | 2 | " Maintainer: The Vim Project <https://github.com/vim/vim> |
| 3 | " Last Change: 2023 Aug 10 |
| 4 | " Former Maintainer: Bram Moolenaar <Bram@vim.org> |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 5 | |
| 6 | " This file is used for ":syntax off". |
| 7 | " It removes the autocommands and stops highlighting for all buffers. |
| 8 | |
| 9 | if !has("syntax") |
| 10 | finish |
| 11 | endif |
| 12 | |
Bram Moolenaar | b21e584 | 2006-04-16 18:30:08 +0000 | [diff] [blame] | 13 | " Remove all autocommands for the Syntax event. This also avoids that |
| 14 | " "syntax=foo" in a modeline triggers the SynSet() function of synload.vim. |
| 15 | au! Syntax |
| 16 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 17 | " remove all syntax autocommands and remove the syntax for each buffer |
| 18 | augroup syntaxset |
| 19 | au! |
| 20 | au BufEnter * syn clear |
| 21 | au BufEnter * if exists("b:current_syntax") | unlet b:current_syntax | endif |
| 22 | doautoall syntaxset BufEnter * |
| 23 | au! |
| 24 | augroup END |
| 25 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 26 | if exists("syntax_on") |
| 27 | unlet syntax_on |
| 28 | endif |
| 29 | if exists("syntax_manual") |
| 30 | unlet syntax_manual |
| 31 | endif |