annotate runtime/ftplugin.vim @ 34405:5337abbdf88e v9.1.0127

patch 9.1.0127: Naming a non-pointer variable "oap" is strange Commit: https://github.com/vim/vim/commit/5e3674b42da10b7e7c72d1f20f9a15379af1b60a Author: zeertzjq <zeertzjq@outlook.com> Date: Thu Feb 22 19:51:34 2024 +0100 patch 9.1.0127: Naming a non-pointer variable "oap" is strange Problem: Naming a non-pointer variable "oap" is strange. Solution: Rename it to "oa". Also prevent using freed memory in case of memory allocation failure. (zeertzjq) closes: #14075 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Thu, 22 Feb 2024 20:00:07 +0100
parents 4027cefc2aab
children
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 #
32770
4027cefc2aab Farewell to Bram and dedicate upcoming Vim 9.1 to him (#12749)
Christian Brabandt <cb@256bit.org>
parents: 27634
diff changeset
5 # Maintainer: The Vim Project <https://github.com/vim/vim>
4027cefc2aab Farewell to Bram and dedicate upcoming Vim 9.1 to him (#12749)
Christian Brabandt <cb@256bit.org>
parents: 27634
diff changeset
6 # Last change: 2023 Aug 10
4027cefc2aab Farewell to Bram and dedicate upcoming Vim 9.1 to him (#12749)
Christian Brabandt <cb@256bit.org>
parents: 27634
diff changeset
7 # Former Maintainer: Bram Moolenaar <Bram@vim.org>
27623
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
8
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
9 if exists("g:did_load_ftplugin")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 endif
27623
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
12 g:did_load_ftplugin = 1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 augroup filetypeplugin
27623
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
15 au FileType * call LoadFTPlugin()
27538
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
16 augroup END
856
8cd729851562 updated for version 7.0g
vimboss
parents: 782
diff changeset
17
27623
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
18 if exists('*LoadFTPlugin')
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
19 # No need to define the function again.
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
20 finish
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
21 endif
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
22
179c118424a6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
23 def LoadFTPlugin()
27538
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
24 if exists("b:undo_ftplugin")
27634
9fe2fed9bb4b Update runtime files. (closes #9741)
Bram Moolenaar <Bram@vim.org>
parents: 27623
diff changeset
25 # 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
26 legacy exe b:undo_ftplugin
27538
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
27 unlet! b:undo_ftplugin b:did_ftplugin
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
28 endif
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
29
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
30 var s = expand("<amatch>")
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
31 if s != ""
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
32 if &cpo =~# "S" && exists("b:did_ftplugin")
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
33 # 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
34 # 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
35 unlet b:did_ftplugin
230
9281a51ca7a2 updated for version 7.0064
vimboss
parents: 36
diff changeset
36 endif
856
8cd729851562 updated for version 7.0g
vimboss
parents: 782
diff changeset
37
27538
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
38 # 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
39 # "aaa.bbb" load "aaa" and then "bbb".
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
40 for name in split(s, '\.')
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
41 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
42 endfor
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
43 endif
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 856
diff changeset
44 enddef