Skip to content

Commit eddd1b9

Browse files
author
skywind3000
committed
2.5.5: -mode=term -pos=tab obeys -focus=0
1 parent a2f9ad0 commit eddd1b9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

plugin/asyncrun.vim

Lines changed: 7 additions & 3 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: 2020/03/06 21:45
6+
" Last Modified: 2020/03/07 05:57
77
"
88
" Run shell command in background and output to quickfix:
99
" :AsyncRun[!] [options] {cmd} ...
@@ -1114,6 +1114,7 @@ function! s:start_in_terminal(opts)
11141114
endif
11151115
endif
11161116
endfor
1117+
let focus = get(a:opts, 'focus', 1)
11171118
if pos == 'tab'
11181119
if get(a:opts, 'reuse', 0) == 0
11191120
exec "tab split"
@@ -1161,6 +1162,10 @@ function! s:start_in_terminal(opts)
11611162
if has_key(a:opts, 'hidden')
11621163
exec 'setlocal bufhidden=' . (hidden? 'hide' : '')
11631164
endif
1165+
if focus == 0
1166+
exec has('nvim')? 'stopinsert' : ''
1167+
exec 'tabprevious'
1168+
endif
11641169
endif
11651170
return 0
11661171
elseif pos == 'cur' || pos == 'curwin' || pos == 'current'
@@ -1186,7 +1191,6 @@ function! s:start_in_terminal(opts)
11861191
let uid = win_getid()
11871192
keepalt noautocmd windo call s:save_restore_view(0)
11881193
keepalt noautocmd call win_gotoid(uid)
1189-
let focus = get(a:opts, 'focus', 1)
11901194
let origin = win_getid()
11911195
if avail < 0
11921196
let rows = get(a:opts, 'rows', '')
@@ -1725,7 +1729,7 @@ endfunc
17251729
" asyncrun - version
17261730
"----------------------------------------------------------------------
17271731
function! asyncrun#version()
1728-
return '2.5.4'
1732+
return '2.5.5'
17291733
endfunc
17301734

17311735

0 commit comments

Comments
 (0)