Skip to content

Commit

Permalink
update: set bufhidden=wipe for terminal buffer by default
Browse files Browse the repository at this point in the history
  • Loading branch information
skywind3000 committed Nov 12, 2022
1 parent 058f0b4 commit 6e3b79a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ There can be some options before your `[cmd]`:
| `-rows=num` | 0 | When using a horizontal split terminal, this value represents the height of terminal window. |
| `-cols=num` | 0 | When using a vertical split terminal, this value represents the width of terminal window. |
| `-focus=?` | 1 | set to `0` to prevent focus changing when `-mode=term` |
| `-hidden=?` | `unset` | set to `1` to init `bufhidden` to `hide` for internal terminal, set to `0` to init `bufhidden` to `delete` |
| `-hidden=?` | 0 | set to `1` to init `bufhidden` to `hide` for internal terminal, set to `0` to init `bufhidden` to `wipe` |
| `-listed=?` | 1 | when using `-mode=term`, set to 0 to hide the terminal in the buffer list |
| `-close` | `unset` | when using `-mode=term`, close the terminal automatically when terminal process is finished |

Expand Down
23 changes: 16 additions & 7 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/13 00:49
" Last Modified: 2022/11/13 01:40
"
" Run shell command in background and output to quickfix:
" :AsyncRun[!] [options] {cmd} ...
Expand Down Expand Up @@ -1257,7 +1257,6 @@ endfunc
"----------------------------------------------------------------------
function! s:terminal_init(opts)
let command = a:opts.cmd
let hidden = get(a:opts, 'hidden', 0)
let shell = (has('nvim') == 0)? 1 : 0
let pos = get(a:opts, 'pos', 'bottom')
let pos = (pos == 'background')? 'hide' : pos
Expand Down Expand Up @@ -1355,14 +1354,24 @@ function! s:terminal_init(opts)
if get(a:opts, 'listed', 1) == 0
setlocal nobuflisted
endif
exec has('nvim')? 'startinsert' : ''
if has_key(a:opts, 'hidden')
let remove = get(g:, 'asyncrun_term_hide', 'delete')
exec 'setlocal bufhidden=' . (hidden? 'hide' : remove)
let hidden = get(g:, 'asyncrun_term_hidden', 'wipe')
let hidden = get(a:opts, 'hidden', hidden)
if type(hidden) == type(0)
let t = (hidden)? 'hide' : 'wipe'
else
let t = (type(hidden) == type(''))? hidden : ''
if t =~ '^\d\+'
let t = (str2nr(t))? 'hide' : 'wipe'
endif
endif
if t != '' || has_key(a:opts, 'hidden')
exec 'setlocal bufhidden=' . t
unsilent echom 't=' . t
endif
if exists('*win_getid')
let info.winid = win_getid()
endif
exec has('nvim')? 'startinsert' : ''
endif
let info.name = get(a:opts, 'name', '')
let info.post = get(a:opts, 'post', '')
Expand Down Expand Up @@ -2108,7 +2117,7 @@ endfunc
" asyncrun - version
"----------------------------------------------------------------------
function! asyncrun#version()
return '2.11.1'
return '2.11.2'
endfunc


Expand Down

0 comments on commit 6e3b79a

Please sign in to comment.