skywind3000 / asyncrun.vim

:rocket: Run Async Shell Commands in Vim 8.0 / NeoVim and Output to the Quickfix Window !!
https://www.vim.org/scripts/script.php?script_id=5431
MIT License
1.84k stars 109 forks source link

Terminate previous job and start a new job #190

Closed aj3423 closed 4 years ago

aj3423 commented 4 years ago

I defined a function which calls ':AsyncRun` to launch an external konsole terminal. Everytime before I launch the terminal, I have to kill the previous one, like this:

function restart_job()
    :AsyncStop!
    exe 'sleep 100m'
    :AsyncRun konsole --noclose -e ...
endfunction

If I don't sleep for 100 milliseconds. the previous job is not terminated yet, which causes error:

ERROR: background job is still running

Any better way of restarting job without using the sleep?

skywind3000 commented 4 years ago

Try this:

AsyncRun -mode=hide konsole --noclose -e ...

And maybe you want to define a new runner for konsole:

https://github.com/skywind3000/asyncrun.vim/wiki/Customize-Runner