ConEmu + WSL:在当前选项卡目录中打开新控制台 [英] ConEmu + WSL: Open new console in current tab directory

查看:43
本文介绍了ConEmu + WSL:在当前选项卡目录中打开新控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 WSL 和 ConEmu 版本 180506.我试图在 ConEmu 中设置一个任务,以便在打开新控制台时使用活动选项卡的当前目录,但我无法让它工作.我所做的是使用 此页面

I'm using WSL and ConEmu build 180506. I'm trying to setup a task in ConEmu to use the current directory of the active tab when opening a new console but I cannot get it to work. What I did is to setup the task {Bash: bash} using the instructions on this page

设置任务命令为:

set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe --wsl -C~ -cur_console:pm:/mnt

然后按照此页面上的说明,我添加到我的 .bashrc

Then following the instruction on this page, I added to my .bashrc

if [[ -n "${ConEmuPID}" ]]; then
  PS1="$PS1\[\e]9;9;\"\w\"\007\e]9;12\007\]"
fi

最后使用宏设置快捷方式:

and finally setup a shortcut using the macro :

Shell("new_console", "{bash}", "", "%CD%")

但它总是在默认目录('/home/[username]')中打开新控制台.

But it always open the new console in the default directory ('/home/[username]').

我不明白我做错了什么.我还注意到许多环境变量此处列出没有设置.基本上,似乎只设置了 $ConEmuPID 和 $ConEmuBuild.

I don't understand what I'm not doing right. I also noticed that a lot of environment variables listed here are not set. Basically, only $ConEmuPID and $ConEmuBuild seem to be set.

任何帮助将不胜感激.

推荐答案

GuiMacro Shell 旨在运行某些命令,而不是任务.

GuiMacro Shell was intended to run certain commands, not tasks.

您认为您可以尝试运行宏 Task("{bash}","%CD%")

You think you may try to run macro Task("{bash}","%CD%")

或者将您的 {bash} 任务参数设置为 -dir %CD% 并为您的任务设置热键.

Or set your {bash} task parameters to -dir %CD% and just set hotkey for your task.

当然,这两种方法都需要从 shell 获取工作 CD.在您的情况下似乎没问题 - %d 显示正确的文件夹.

Of course both methods require working CD acquisition from shell. Seems like it's OK in your case - %d shows proper folder.

这篇关于ConEmu + WSL:在当前选项卡目录中打开新控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆