Mercurial > vim
annotate runtime/ftplugin.vim @ 31505:dc282943639c v9.0.1085
patch 9.0.1085: compiler warns for uninitialized variable
Commit: https://github.com/vim/vim/commit/9b8a365d019bb948efba5b5276d52bdd99e15d05
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Dec 20 20:47:28 2022 +0000
patch 9.0.1085: compiler warns for uninitialized variable
Problem: Compiler warns for uninitialized variable.
Solution: Initialize the variable. Remove unused function. (John Marriott)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 20 Dec 2022 22:00:04 +0100 |
parents | 9fe2fed9bb4b |
children | 4027cefc2aab |
rev | line source |
---|---|
27623 | 1 vim9script noclear |
7 | 2 |
27623 | 3 # Vim support file to switch on loading plugins for file types |
4 # | |
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 | 7 |
8 if exists("g:did_load_ftplugin") | |
7 | 9 finish |
10 endif | |
27623 | 11 g:did_load_ftplugin = 1 |
7 | 12 |
13 augroup filetypeplugin | |
27623 | 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 | 16 |
27623 | 17 if exists('*LoadFTPlugin') |
18 # No need to define the function again. | |
19 finish | |
20 endif | |
21 | |
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 | 35 endif |
856 | 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 |