Skip to content

Commit 3cb6226

Browse files
author
skywind3000
committed
more safe to start a terminal
1 parent a9b569e commit 3cb6226

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ See: [Cooperate with famous plugins](https://github.com/skywind3000/asyncrun.vim
288288

289289
## History
290290

291+
- 2.2.5 (2020-02-05): more safe to start a terminal.
291292
- 2.2.4 (2020-02-05): exit when starting terminal failed in current window with `-pos=curwin`.
292293
- 2.2.3 (2020-02-05): new `-program=wsl` to run command in wsl (windows 10 only).
293294
- 2.2.2 (2020-02-05): new `-pos=curwin` to open terminal in current window.

plugin/asyncrun.vim

Lines changed: 17 additions & 9 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/02/05 06:23
6+
" Last Modified: 2020/02/05 06:36
77
"
88
" Run shell command in background and output to quickfix:
99
" :AsyncRun[!] [options] {cmd} ...
@@ -1090,11 +1090,15 @@ function! s:start_in_terminal(opts)
10901090
else
10911091
exec cmd . ' ' . command
10921092
endif
1093-
setlocal nonumber signcolumn=no norelativenumber
1093+
if &bt == 'terminal'
1094+
setlocal nonumber signcolumn=no norelativenumber
1095+
endif
10941096
else
10951097
exec 'tabe term://'. fnameescape(command)
1096-
setlocal nonumber signcolumn=no norelativenumber
1097-
startinsert
1098+
if &bt == 'terminal'
1099+
setlocal nonumber signcolumn=no norelativenumber
1100+
startinsert
1101+
endif
10981102
endif
10991103
return 0
11001104
elseif pos == 'cur' || pos == 'curwin' || pos == 'current'
@@ -1150,13 +1154,17 @@ function! s:start_in_terminal(opts)
11501154
else
11511155
exec cmd . ' ++kill=term ' . command
11521156
endif
1153-
setlocal nonumber signcolumn=no norelativenumber
1157+
if &bt == 'terminal'
1158+
setlocal nonumber signcolumn=no norelativenumber
1159+
endif
11541160
else
11551161
exec 'term '. command
1156-
setlocal nonumber signcolumn=no norelativenumber
1157-
startinsert
1162+
if &bt == 'terminal'
1163+
setlocal nonumber signcolumn=no norelativenumber
1164+
startinsert
1165+
endif
11581166
endif
1159-
if focus == 0
1167+
if focus == 0 && &bt == 'terminal'
11601168
silent! stopinsert
11611169
call win_gotoid(origin)
11621170
endif
@@ -1562,7 +1570,7 @@ endfunc
15621570
" asyncrun -version
15631571
"----------------------------------------------------------------------
15641572
function! asyncrun#version()
1565-
return '2.2.4'
1573+
return '2.2.5'
15661574
endfunc
15671575

15681576

0 commit comments

Comments
 (0)