codekingpro/portable-devtools
115k
1vim9script noclear2 3# Vim support file to switch on loading plugins for file types4#5# Maintainer: The Vim Project <https://github.com/vim/vim>6# Last change: 2023 Aug 107# Former Maintainer: Bram Moolenaar <Bram@vim.org>8 9if exists("g:did_load_ftplugin")10 finish11endif12g:did_load_ftplugin = 113 14augroup filetypeplugin15 au FileType * call LoadFTPlugin()16augroup END17 18if exists('*LoadFTPlugin')19 # No need to define the function again.20 finish21endif22 23def LoadFTPlugin()24 if exists("b:undo_ftplugin")25 # We assume b:undo_ftplugin is using legacy script syntax26 legacy exe b:undo_ftplugin27 unlet! b:undo_ftplugin b:did_ftplugin28 endif29 30 var s = expand("<amatch>")31 if s != ""32 if &cpo =~# "S" && exists("b:did_ftplugin")33 # In compatible mode options are reset to the global values, need to34 # set the local values also when a plugin was already used.35 unlet b:did_ftplugin36 endif37 38 # When there is a dot it is used to separate filetype names. Thus for39 # "aaa.bbb" load "aaa" and then "bbb".40 for name in split(s, '\.')41 exe 'runtime! ftplugin/' .. name .. '.vim ftplugin/' .. name .. '_*.vim ftplugin/' .. name .. '/*.vim'42 endfor43 endif44enddef45 