Skip to content

Commit

Permalink
Load denops.vim automatically if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Jan 20, 2025
1 parent a65b972 commit fc100d1
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions autoload/dpp.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
function dpp#get(name = '') abort
return a:name ==# '' ?
\ g:dpp#_plugins->copy() : g:dpp#_plugins->get(a:name, {})
return !'g:dpp#_plugins'->exists()
\ ? {}
\ : a:name ==# ''
\ ? g:dpp#_plugins->copy()
\ : g:dpp#_plugins->get(a:name, {})
endfunction

function dpp#source(
Expand All @@ -15,6 +18,11 @@ function dpp#sync_ext_action(ext_name, action_name, action_params={}) abort
return
endif

if !'g:loaded_denops'->exists() && !dpp#get('denops.vim')->empty()
" Load denops.vim
call dpp#source('denops.vim')
endif

if !'g:loaded_denops'->exists()
call dpp#util#_error(
\ 'denops.vim must be loaded before "dpp#sync_ext_action()".')
Expand All @@ -32,6 +40,11 @@ function dpp#async_ext_action(ext_name, action_name, action_params={}) abort
return
endif

if !'g:loaded_denops'->exists() && !dpp#get('denops.vim')->empty()
" Load denops.vim
call dpp#source('denops.vim')
endif

return dpp#denops#_notify('extAction', [
\ a:ext_name, a:action_name, a:action_params])
endfunction
Expand All @@ -56,6 +69,11 @@ function dpp#make_state(
return 1
endif

if !'g:loaded_denops'->exists() && !dpp#get('denops.vim')->empty()
" Load denops.vim
call dpp#source('denops.vim')
endif

return dpp#denops#_notify('makeState', [base_path, config_path, a:name])
endfunction

Expand Down

0 comments on commit fc100d1

Please sign in to comment.