Skip to content

Commit 2483bbd

Browse files
author
skywind3000
committed
fixed issues in :AsyncReset
1 parent a7a83c1 commit 2483bbd

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

plugin/asyncrun.vim

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
" Maintainer: skywind3000 (at) gmail.com, 2016-2022
44
" Homepage: https://github.com/skywind3000/asyncrun.vim
55
"
6-
" Last Modified: 2022/09/12 01:46
6+
" Last Modified: 2022/09/13 17:50
77
"
88
" Run shell command in background and output to quickfix:
99
" :AsyncRun[!] [options] {cmd} ...
@@ -2079,6 +2079,23 @@ function! asyncrun#version()
20792079
endfunc
20802080

20812081

2082+
"----------------------------------------------------------------------
2083+
" asyncrun - reset
2084+
"----------------------------------------------------------------------
2085+
function! asyncrun#reset()
2086+
call asyncrun#stop('!')
2087+
let s:async_state = 0
2088+
if exists('s:async_timer')
2089+
call timer_stop(s:async_timer)
2090+
unlet s:async_timer
2091+
endif
2092+
if exists('s:async_job')
2093+
unlet s:async_job
2094+
endif
2095+
let s:async_state = 0
2096+
endfunc
2097+
2098+
20822099
"----------------------------------------------------------------------
20832100
" Commands
20842101
"----------------------------------------------------------------------
@@ -2087,8 +2104,7 @@ command! -bang -nargs=+ -range=0 -complete=file AsyncRun
20872104

20882105
command! -bar -bang -nargs=0 AsyncStop call asyncrun#stop('<bang>')
20892106

2090-
let s:script_name = expand('<sfile>:p')
2091-
command! -nargs=0 AsyncReset exec 'source ' . fnameescape(s:script_name)
2107+
command! -nargs=0 AsyncReset call asyncrun#reset()
20922108

20932109

20942110
"----------------------------------------------------------------------

0 commit comments

Comments
 (0)