Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bottom:内置终端,不可以复用内部终端 #52

Open
winq2008 opened this issue Dec 5, 2020 · 3 comments
Open

bottom:内置终端,不可以复用内部终端 #52

winq2008 opened this issue Dec 5, 2020 · 3 comments

Comments

@winq2008
Copy link

winq2008 commented Dec 5, 2020

bottom:内置终端,不可以复用内部终端
每次运行都打开一个终端
vimrc配置:
noremap :AsyncTask file-run
noremap :AsyncTask file-build
let g:asyncrun_open = 6
let g:asynctasks_term_pos = 'bottom'
let g:asynctasks_term_rows = 5

tasks.ini配置:
[file-build]
command=gcc "$(VIM_FILEPATH)" -o "$(VIM_FILEDIR)/$(VIM_FILENOEXT)"
command:go=go build -o "$(VIM_PATHNOEXT)" "$(VIM_FILEPATH)"
cwd=$(VIM_FILEDIR)
output=quickfix
errorformat=%f:%l:%m
save=2

[file-run]
command="$(VIM_FILEPATH)"
command:c,cpp="$(VIM_PATHNOEXT)"
command:go=go run "$(VIM_FILEPATH)"
command:python=python "$(VIM_FILENAME)"
output=terminal
cmd=$(VIM_FILEDIR)
save=2

@yolo2h
Copy link

yolo2h commented Jan 26, 2021

我也遇到了这个问题,设置let g:asynctasks_term_reuse = 1后解决。

@skywind3000
Copy link
Owner

skywind3000 commented Jan 26, 2021

默认的内置终端必须在任务结束的情况下才能复用,如果老任务没有结束,则会创建新的窗口。

可以考虑使用 vim-terminal-help 提供的交互式终端,每次运行的时候只是发送命令过去,不会创建新的终端窗口,搭配 asyncrun.extra,可以让 asyncrun/asynctasks 具备调用 terminal-help 的能力,然后设置:

let g:asynctasks_term_pos = 'termhelp'

你基本就得到了一个和 vscode 一样的可复用终端了:

@yolo2h
Copy link

yolo2h commented Jan 28, 2021

我好像理解错了,asynctasks_term_pos在设置为topbottomleftright时(且设置output=terminal)终端窗口复用是默认选项嘛?如果不是的话此章节的说明可能会有些歧义(从章节开始至如下引用间未提及需要声明asynctasks_term_reuse=1才会开启终端复用)。

终端窗口会复用,如果上一个任务结束了,再次运行时不会新建终端窗口,会先尝试复用老的已结束的终端窗口,找不到才会新建。

BTW: vim-terminal-help很方便,我改为使用vim-terminal-help了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants