ConEmu + WSL: Open new console in current tab directory

前提是你 提交于 2019-12-10 16:19:10

问题


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.


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/50335007/conemu-wsl-open-new-console-in-current-tab-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!