Skip to content

Commit

Permalink
improve <nomodeline> compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
skywind3000 committed Nov 2, 2022
1 parent 2766279 commit b32d598
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions plugin/asyncrun.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
" Maintainer: skywind3000 (at) gmail.com, 2016-2022
" Homepage: https://github.com/skywind3000/asyncrun.vim
"
" Last Modified: 2022/11/02 17:53
" Last Modified: 2022/11/02 18:41
"
" Run shell command in background and output to quickfix:
" :AsyncRun[!] [options] {cmd} ...
Expand Down Expand Up @@ -230,14 +230,21 @@ function! s:NotSupport()
call s:ErrorMsg(msg)
endfunc

" doautocmd
function! s:DoAutoCmd(text)
let cmd = (g:asyncrun_silent)? 'silent doautocmd' : 'doautocmd'
if v:version >= 704
let cmd = cmd . ' <nomodeline>'
endif
if has('autocmd')
exec cmd . ' ' . a:text
endif
endfunc

" run autocmd
function! s:AutoCmd(name)
if has('autocmd') && ((g:asyncrun_skip / 2) % 2) == 0
if g:asyncrun_silent
exec 'silent doautocmd <nomodeline> User AsyncRun'.a:name
else
exec 'doautocmd <nomodeline> User AsyncRun'.a:name
endif
call s:DoAutoCmd('User AsyncRun' . a:name)
endif
endfunc

Expand Down Expand Up @@ -528,17 +535,9 @@ function! s:AsyncRun_Job_AutoCmd(mode, auto)
return 0
endif
if a:mode == 0
if g:asyncrun_silent
silent exec 'doautocmd <nomodeline> QuickFixCmdPre '. name
else
exec 'doautocmd <nomodeline> QuickFixCmdPre '. name
endif
call s:DoAutoCmd('QuickFixCmdPre ' . name)
else
if g:asyncrun_silent
silent exec 'doautocmd <nomodeline> QuickFixCmdPost '. name
else
exec 'doautocmd <nomodeline> QuickFixCmdPost '. name
endif
call s:DoAutoCmd('QuickFixCmdPost ' . name)
endif
endfunc

Expand Down Expand Up @@ -2108,7 +2107,7 @@ endfunc
" asyncrun - version
"----------------------------------------------------------------------
function! asyncrun#version()
return '2.10.7'
return '2.10.8'
endfunc


Expand Down

0 comments on commit b32d598

Please sign in to comment.