Mercurial > vim
comparison runtime/ftplugin.vim @ 27538:f37561549ec2
Update runtime files; use compiled functions
Commit: https://github.com/vim/vim/commit/3e79c97c18c50f97797ab13ed81c4011eba9aba0
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Feb 4 19:48:06 2022 +0000
Update runtime files; use compiled functions
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 04 Feb 2022 21:00:05 +0100 |
parents | 8cd729851562 |
children | 179c118424a6 |
comparison
equal
deleted
inserted
replaced
27537:063952f68595 | 27538:f37561549ec2 |
---|---|
1 " Vim support file to switch on loading plugins for file types | 1 " Vim support file to switch on loading plugins for file types |
2 " | 2 " |
3 " Maintainer: Bram Moolenaar <Bram@vim.org> | 3 " Maintainer: Bram Moolenaar <Bram@vim.org> |
4 " Last change: 2006 Apr 30 | 4 " Last change: 2022 Feb 04 |
5 | 5 |
6 if exists("did_load_ftplugin") | 6 if exists("did_load_ftplugin") |
7 finish | 7 finish |
8 endif | 8 endif |
9 let did_load_ftplugin = 1 | 9 let did_load_ftplugin = 1 |
10 | 10 |
11 augroup filetypeplugin | 11 augroup filetypeplugin |
12 au FileType * call s:LoadFTPlugin() | 12 au FileType * call s:LoadFTPlugin() |
13 augroup END | |
13 | 14 |
14 func! s:LoadFTPlugin() | 15 def s:LoadFTPlugin() |
15 if exists("b:undo_ftplugin") | 16 if exists("b:undo_ftplugin") |
16 exe b:undo_ftplugin | 17 exe b:undo_ftplugin |
17 unlet! b:undo_ftplugin b:did_ftplugin | 18 unlet! b:undo_ftplugin b:did_ftplugin |
19 endif | |
20 | |
21 var s = expand("<amatch>") | |
22 if s != "" | |
23 if &cpo =~# "S" && exists("b:did_ftplugin") | |
24 # In compatible mode options are reset to the global values, need to | |
25 # set the local values also when a plugin was already used. | |
26 unlet b:did_ftplugin | |
18 endif | 27 endif |
19 | 28 |
20 let s = expand("<amatch>") | 29 # When there is a dot it is used to separate filetype names. Thus for |
21 if s != "" | 30 # "aaa.bbb" load "aaa" and then "bbb". |
22 if &cpo =~# "S" && exists("b:did_ftplugin") | 31 for name in split(s, '\.') |
23 " In compatible mode options are reset to the global values, need to | 32 exe 'runtime! ftplugin/' .. name .. '.vim ftplugin/' .. name .. '_*.vim ftplugin/' .. name .. '/*.vim' |
24 " set the local values also when a plugin was already used. | 33 endfor |
25 unlet b:did_ftplugin | 34 endif |
26 endif | 35 enddef |
27 | |
28 " When there is a dot it is used to separate filetype names. Thus for | |
29 " "aaa.bbb" load "aaa" and then "bbb". | |
30 for name in split(s, '\.') | |
31 exe 'runtime! ftplugin/' . name . '.vim ftplugin/' . name . '_*.vim ftplugin/' . name . '/*.vim' | |
32 endfor | |
33 endif | |
34 endfunc | |
35 augroup END |