Skip to content

Commit 53de526

Browse files
author
skywind3000
committed
2.8.2: new '-close' option for '-mode=term'
1 parent 8b38aa7 commit 53de526

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ There can be some options before your `[cmd]`:
186186
| `-focus=?` | 1 | set to `0` to prevent focus changing when `-mode=term` |
187187
| `-hidden=?` | 0 | set to `1` to setup `bufhidden` to `hide` for internal terminal |
188188
| `-silent` | `unset` | provide `-silent` to prevent open quickfix window (will override `g:asyncrun_open` temporarily) |
189+
| `-close` | `unset` | when using `-mode=term`, close the terminal automatically when terminal process finished |
189190

190191
All options must start with a minus and position **before** `[cmd]`. Since no shell command string starts with a minus. So they can be distinguished from shell command easily without any ambiguity.
191192

@@ -279,6 +280,7 @@ For more information, please see [here](https://github.com/skywind3000/asyncrun.
279280
AsyncRun is capable to run commands in Vim/NeoVim's internal terminal with the `-mode=term` option. You can specify how to open the terminal window by `-pos=?`, available positions are:
280281

281282
- `-pos=tab`: open the terminal in a new tab.
283+
- `-pos=TAB`: open the terminal in a new tab on the left of current tab.
282284
- `-pos=curwin`: open the terminal in the current window.
283285
- `-pos=top`: open the terminal above the current window.
284286
- `-pos=bottom`: open the terminal below the current window.
@@ -291,6 +293,7 @@ Examples:
291293

292294
```VimL
293295
:AsyncRun -mode=term -pos=tab python "$(VIM_FILEPATH)"
296+
:AsyncRun -mode=term -pos=TAB -close -cwd=<root> lazygit
294297
:AsyncRun -mode=term -pos=bottom -rows=10 python "$(VIM_FILEPATH)"
295298
:AsyncRun -mode=term -pos=right -cols=80 python "$(VIM_FILEPATH)"
296299
:AsyncRun -mode=term -pos=curwin python "$(VIM_FILEPATH)"

plugin/asyncrun.vim

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
" Maintainer: skywind3000 (at) gmail.com, 2016, 2017, 2018, 2019, 2020
44
" Homepage: http://www.vim.org/scripts/script.php?script_id=5431
55
"
6-
" Last Modified: 2021/02/03 01:48
6+
" Last Modified: 2021/02/03 12:49
77
"
88
" Run shell command in background and output to quickfix:
99
" :AsyncRun[!] [options] {cmd} ...
@@ -1156,6 +1156,10 @@ function! s:terminal_open(opts)
11561156
let opts = {'curwin':1, 'norestore':1, 'term_finish':'open'}
11571157
let opts.term_kill = 'term'
11581158
let opts.exit_cb = function('s:terminal_exit')
1159+
let close = get(a:opts, 'close', 0)
1160+
if close
1161+
let opts.term_finish = 'close'
1162+
endif
11591163
try
11601164
let bid = term_start(command, opts)
11611165
catch /^.*/
@@ -1880,7 +1884,7 @@ endfunc
18801884
" asyncrun - version
18811885
"----------------------------------------------------------------------
18821886
function! asyncrun#version()
1883-
return '2.8.1'
1887+
return '2.8.2'
18841888
endfunc
18851889

18861890

0 commit comments

Comments
 (0)