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

-close 不work。。。 #283

Open
pinggit opened this issue Mar 21, 2024 · 7 comments
Open

-close 不work。。。 #283

pinggit opened this issue Mar 21, 2024 · 7 comments

Comments

@pinggit
Copy link

pinggit commented Mar 21, 2024

AsyncRun -save=1 -focus=0 -cwd=$(VIM_FILEDIR) -mode=term -rows=20 -close python3 %
AsyncRun -save=1 -focus=0 -cwd=$(VIM_FILEDIR) -mode=term -rows=20 -close pwd

这么用有问题吗?

@skywind3000
Copy link
Owner

skywind3000 commented Mar 22, 2024

可以用的啊,我刚又试过,-close 就是运行完自动关闭终端啊,速度太快你没看清吧,你运行个 sleep 5 试试

@pinggit
Copy link
Author

pinggit commented Mar 22, 2024

sleep 5 是可以的
但是pwd就不行。。
这是应该的?

@skywind3000
Copy link
Owner

skywind3000 commented Mar 22, 2024

当然,pwd 的输出一闪而过。

@pinggit
Copy link
Author

pinggit commented Mar 22, 2024 via email

@skywind3000
Copy link
Owner

skywind3000 commented Mar 22, 2024

根本不是,和快慢没关系,快慢只关系到你看得到么。

你的 work 是啥意思?根本就没有运行?还是只是一闪而过没看到?

(提问时能不能多给点信息,不要惜字如金光写个 work 让我去猜,信息你都不肯多给点,让我怎么给你回答呢?)

另外你的第一条命令有问题:

AsyncRun -save=1 -focus=0 -cwd=$(VIM_FILEDIR) -mode=term -rows=20 -close python3 %

你已经通过 -cwd=xxx 改变了 python 执行时的路径了,而 % 是基于 vim 当前路径给出的相对路径,那么如果 vim 当前路径不是文件所在位置的话,你这么写就会出错,另外你忘记加引号了,正确的写法是全部使用 $(VIM_xxx) 变量:

AsyncRun -save=1 -focus=0 -cwd=$(VIM_FILEDIR) -mode=term -rows=20 -close python3 "$(VIM_FILENAME)"

或者:

AsyncRun -save=1 -focus=0 -cwd=$(VIM_FILEDIR) -mode=term -rows=20 -close python3 "$(VIM_FILEPATH)"

@pinggit
Copy link
Author

pinggit commented Mar 22, 2024 via email

@pinggit
Copy link
Author

pinggit commented Mar 24, 2024

-close的意思是:

  1. -mode=term 打开内置terminal
  2. Asynrun在终端上执行命令
  3. 命令结束,输出结果在终端
  4. -close会自动把打开的终端关上。

对吧?

但是我发现1-3都正常,但#4没执行。打开的terminal还在。我每次都要去手工关掉。
如果命令是sleep 5, -close会关掉终端。正常。
如果命令是pwd这种,命令执行完,终端一直在,不会关掉。

我漏掉了什么设置了吗还是理解有误?

按照我的理解,目前的解决方法就是任何要执行的命令后面加个sleep,就达到期望值了 (terminal自动关掉)。

AsyncRun -save=1 -focus=0 -cwd=$(VIM_FILEDIR) -mode=term -rows=10 -close python3 "$(VIM_FILENAME)" ;sleep 5

不知道有没有更好的解决方法?

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

2 participants