Skip to content

Commit 6d5e981

Browse files
author
skywind3000
committed
new option g:asyncrun_term_wipe, set to non-zero to change the &bufhidden of terminal buffer to 'wipe' when command finished.
1 parent 4c1b475 commit 6d5e981

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

plugin/asyncrun.vim

Lines changed: 13 additions & 6 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/11/13 01:42
6+
" Last Modified: 2022/11/19 01:07
77
"
88
" Run shell command in background and output to quickfix:
99
" :AsyncRun[!] [options] {cmd} ...
@@ -1354,7 +1354,7 @@ function! s:terminal_init(opts)
13541354
if get(a:opts, 'listed', 1) == 0
13551355
setlocal nobuflisted
13561356
endif
1357-
let hidden = get(g:, 'asyncrun_term_hidden', 'wipe')
1357+
let hidden = get(g:, 'asyncrun_term_hidden', '')
13581358
let hidden = get(a:opts, 'hidden', hidden)
13591359
if type(hidden) == type(0)
13601360
let t = (hidden)? 'hide' : 'wipe'
@@ -1421,9 +1421,16 @@ function! s:terminal_exit(...)
14211421
unlet s:async_term[pid]
14221422
let g:asyncrun_code = code
14231423
let g:asyncrun_name = info.name
1424-
if info.close != 0
1425-
let bid = info.bid
1426-
if bid >= 0
1424+
let bid = info.bid
1425+
if bid >= 0
1426+
let need_wipe = get(g:, 'asyncrun_term_wipe', 0)
1427+
if need_wipe
1428+
let bh = getbufvar(bid, '&bufhidden', '')
1429+
if empty(bh)
1430+
call setbufvar(bid, '&bufhidden', 'wipe')
1431+
endif
1432+
endif
1433+
if info.close != 0
14271434
if getbufvar(bid, '&bt', '') == 'terminal'
14281435
silent! exec "bd! " . bid
14291436
endif
@@ -2117,7 +2124,7 @@ endfunc
21172124
" asyncrun - version
21182125
"----------------------------------------------------------------------
21192126
function! asyncrun#version()
2120-
return '2.11.2'
2127+
return '2.11.3'
21212128
endfunc
21222129

21232130

plugin/script_load.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
let g:asyncrun_event = get(g:, 'asyncrun_event', {})
1717
let g:asyncrun_runner = get(g:, 'asyncrun_runner', {})
1818
let g:asyncrun_program = get(g:, 'asyncrun_program', {})
19+
" let g:asyncrun_term_hidden = get(g:, 'asyncrun_term_hidden', 'wipe')
20+
let g:asyncrun_term_wipe = get(g:, 'asyncrun_term_wipe', 1)
1921
let s:script_time = {}
2022

2123
let $PYTHONUNBUFFERED = '1'

0 commit comments

Comments
 (0)