Skip to content

Commit 6e3b79a

Browse files
author
skywind3000
committed
update: set bufhidden=wipe for terminal buffer by default
1 parent 058f0b4 commit 6e3b79a

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ There can be some options before your `[cmd]`:
204204
| `-rows=num` | 0 | When using a horizontal split terminal, this value represents the height of terminal window. |
205205
| `-cols=num` | 0 | When using a vertical split terminal, this value represents the width of terminal window. |
206206
| `-focus=?` | 1 | set to `0` to prevent focus changing when `-mode=term` |
207-
| `-hidden=?` | `unset` | set to `1` to init `bufhidden` to `hide` for internal terminal, set to `0` to init `bufhidden` to `delete` |
207+
| `-hidden=?` | 0 | set to `1` to init `bufhidden` to `hide` for internal terminal, set to `0` to init `bufhidden` to `wipe` |
208208
| `-listed=?` | 1 | when using `-mode=term`, set to 0 to hide the terminal in the buffer list |
209209
| `-close` | `unset` | when using `-mode=term`, close the terminal automatically when terminal process is finished |
210210

plugin/asyncrun.vim

Lines changed: 16 additions & 7 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 00:49
6+
" Last Modified: 2022/11/13 01:40
77
"
88
" Run shell command in background and output to quickfix:
99
" :AsyncRun[!] [options] {cmd} ...
@@ -1257,7 +1257,6 @@ endfunc
12571257
"----------------------------------------------------------------------
12581258
function! s:terminal_init(opts)
12591259
let command = a:opts.cmd
1260-
let hidden = get(a:opts, 'hidden', 0)
12611260
let shell = (has('nvim') == 0)? 1 : 0
12621261
let pos = get(a:opts, 'pos', 'bottom')
12631262
let pos = (pos == 'background')? 'hide' : pos
@@ -1355,14 +1354,24 @@ function! s:terminal_init(opts)
13551354
if get(a:opts, 'listed', 1) == 0
13561355
setlocal nobuflisted
13571356
endif
1358-
exec has('nvim')? 'startinsert' : ''
1359-
if has_key(a:opts, 'hidden')
1360-
let remove = get(g:, 'asyncrun_term_hide', 'delete')
1361-
exec 'setlocal bufhidden=' . (hidden? 'hide' : remove)
1357+
let hidden = get(g:, 'asyncrun_term_hidden', 'wipe')
1358+
let hidden = get(a:opts, 'hidden', hidden)
1359+
if type(hidden) == type(0)
1360+
let t = (hidden)? 'hide' : 'wipe'
1361+
else
1362+
let t = (type(hidden) == type(''))? hidden : ''
1363+
if t =~ '^\d\+'
1364+
let t = (str2nr(t))? 'hide' : 'wipe'
1365+
endif
1366+
endif
1367+
if t != '' || has_key(a:opts, 'hidden')
1368+
exec 'setlocal bufhidden=' . t
1369+
unsilent echom 't=' . t
13621370
endif
13631371
if exists('*win_getid')
13641372
let info.winid = win_getid()
13651373
endif
1374+
exec has('nvim')? 'startinsert' : ''
13661375
endif
13671376
let info.name = get(a:opts, 'name', '')
13681377
let info.post = get(a:opts, 'post', '')
@@ -2108,7 +2117,7 @@ endfunc
21082117
" asyncrun - version
21092118
"----------------------------------------------------------------------
21102119
function! asyncrun#version()
2111-
return '2.11.1'
2120+
return '2.11.2'
21122121
endfunc
21132122

21142123

0 commit comments

Comments
 (0)