annotate runtime/ftplugin.vim @ 27939:56babd8ac3c3

Added tag v8.2.4494 for changeset b65a50d2fa4f4ed5d5729d9b14d96edac93b3f63
author Bram Moolenaar <Bram@vim.org>
date Wed, 02 Mar 2022 21:30:04 +0100
parents 9fe2fed9bb4b
children 4027cefc2aab
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27623
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
1 vim9script noclear
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2
27623
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
3 # Vim support file to switch on loading plugins for file types
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
4 #
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
5 # Maintainer: Bram Moolenaar <Bram@vim.org>
27634
9fe2fed9bb4b Update runtime files. (closes #9741)
Bram Moolenaar <Bram@vim.org>
parents: 27623
diff changeset
6 # Last change: 2022 Feb 11
27623
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
7
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
8 if exists("g:did_load_ftplugin")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 endif
27623
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
11 g:did_load_ftplugin = 1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 augroup filetypeplugin
27623
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
14 au FileType * call LoadFTPlugin()
27538
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
15 augroup END
856
8cd729851562 updated for version 7.0g
vimboss
parents: 782
diff changeset
16
27623
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
17 if exists('*LoadFTPlugin')
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
18 # No need to define the function again.
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
19 finish
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
20 endif
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
21
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
22 def LoadFTPlugin()
27538
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
23 if exists("b:undo_ftplugin")
27634
9fe2fed9bb4b Update runtime files. (closes #9741)
Bram Moolenaar <Bram@vim.org>
parents: 27623
diff changeset
24 # We assume b:undo_ftplugin is using legacy script syntax
9fe2fed9bb4b Update runtime files. (closes #9741)
Bram Moolenaar <Bram@vim.org>
parents: 27623
diff changeset
25 legacy exe b:undo_ftplugin
27538
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
26 unlet! b:undo_ftplugin b:did_ftplugin
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
27 endif
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
28
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
29 var s = expand("<amatch>")
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
30 if s != ""
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
31 if &cpo =~# "S" && exists("b:did_ftplugin")
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
32 # In compatible mode options are reset to the global values, need to
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
33 # set the local values also when a plugin was already used.
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
34 unlet b:did_ftplugin
230
9281a51ca7a2 updated for version 7.0064
vimboss
parents: 36
diff changeset
35 endif
856
8cd729851562 updated for version 7.0g
vimboss
parents: 782
diff changeset
36
27538
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
37 # When there is a dot it is used to separate filetype names. Thus for
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
38 # "aaa.bbb" load "aaa" and then "bbb".
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
39 for name in split(s, '\.')
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
40 exe 'runtime! ftplugin/' .. name .. '.vim ftplugin/' .. name .. '_*.vim ftplugin/' .. name .. '/*.vim'
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
41 endfor
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
42 endif
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
43 enddef