Skip to content

Commit

Permalink
Use nested for autocmd
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed May 27, 2024
1 parent 90d7e5e commit c1d8759
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions autoload/ddu/denops.vim
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function ddu#denops#_request(method, args) abort

if !ddu#denops#_running()
" Lazy call
execute printf('autocmd User DenopsPluginPost:ddu call '
execute printf('autocmd User DenopsPluginPost:ddu ++nested call '
\ .. 's:notify("%s", %s)', a:method, a:args->string())
return {}
endif
Expand All @@ -28,7 +28,7 @@ function ddu#denops#_notify(method, args) abort

if !ddu#denops#_running()
" Lazy call
execute printf('autocmd User DenopsPluginPost:ddu call '
execute printf('autocmd User DenopsPluginPost:ddu ++nested call '
\ .. 's:notify("%s", %s)', a:method, a:args->string())
return {}
endif
Expand All @@ -54,7 +54,7 @@ function s:register() abort
call ddu#denops#_load('ddu',
\ [s:root_dir, 'denops', 'ddu', 'app.ts']->join(s:sep))

autocmd ddu User DenopsClosed call s:stopped()
autocmd ddu User DenopsClosed ++nested call s:stopped()
endfunction
function s:stopped() abort
unlet! g:ddu#_initialized
Expand Down Expand Up @@ -90,8 +90,9 @@ function s:init() abort

augroup ddu
autocmd!
autocmd User DenopsPluginPost:ddu let g:ddu#_initialized = v:true
autocmd User Ddu:redraw,Ddu:uiReady,Ddu:uiDone :
autocmd User DenopsPluginPost:ddu ++nested
\ let g:ddu#_initialized = v:true
autocmd User Ddu:redraw,Ddu:uiReady,Ddu:uiDone ++nested :
augroup END

let g:ddu#_started = reltime()
Expand All @@ -104,6 +105,6 @@ function s:init() abort
\ denops#server#status() ==# 'running')
call s:register()
else
autocmd ddu User DenopsReady call s:register()
autocmd ddu User DenopsReady ++nested call s:register()
endif
endfunction

0 comments on commit c1d8759

Please sign in to comment.