ConEmu + WSL: Open new console in current tab dire

2019-06-26 14:55发布

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

setting the task command as :

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

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%")

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

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.

Any help would be appreciated.

2条回答
beautiful°
2楼-- · 2019-06-26 15:25

I found the answer:

Shell("new_console:I", "bash.exe", "", "%CD%")

The readme is actually pretty good: https://github.com/cmderdev/cmder/blob/master/README.md

查看更多
forever°为你锁心
3楼-- · 2019-06-26 15:29

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

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

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

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

查看更多
登录 后发表回答