Skip to content

Commit

Permalink
Improve source
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Dec 8, 2024
1 parent b839d19 commit ddcc09f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions autoload/dpp/source.vim
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,26 @@ function dpp#source#_source(plugins, function_prefix) abort

" Reload script files.
for plugin in sourced
for directory in ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']
for directory in
\ ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']
\ ->filter({ _, val -> (plugin.rtp .. '/' .. val)->isdirectory() })
\ ->map({ _, val -> plugin.rtp .. '/' .. val })
if directory =~# 'ftdetect'
if !plugin->get('merge_ftdetect')
execute 'augroup filetypedetect'
endif
endif
let files = (directory .. '/**/*.vim')->glob(v:true, v:true)

let files = []
let files += (directory .. '/**/*.vim')->glob(v:true, v:true)
if has('nvim')
let files += (directory .. '/**/*.lua')->glob(v:true, v:true)
endif

for file in files
execute 'source' file->fnameescape()
endfor

if directory =~# 'ftdetect'
execute 'augroup END'
endif
Expand All @@ -64,8 +69,10 @@ function dpp#source#_source(plugins, function_prefix) abort
if !has('vim_starting')
let augroup = plugin->get('augroup',
\ plugin->dpp#util#_get_normalized_name())
let events = ['VimEnter', 'BufRead', 'BufEnter',
\ 'BufWinEnter', 'WinEnter']
let events = [
\ 'VimEnter', 'BufRead', 'BufEnter',
\ 'BufWinEnter', 'WinEnter',
\ ]
if has('gui_running') && &term ==# 'builtin_gui'
call add(events, 'GUIEnter')
endif
Expand Down

0 comments on commit ddcc09f

Please sign in to comment.