1

I'm using WSL2 with ComEmu. When I just setup a task only by wsl.exe it open the bash with /mnt/c/Users/username directory. So I set up the command like this.

wsl.exe -cur_console:pm:/mnt ~

With this config I can open a bash terminal with home directory in Ubuntu.

After that I created a my_project directory and change current to it.

mkdir my_project
cd my_project

Now I open a new tab, then I go back to my Ubuntu home directory. How can I open a new bash tab while keeping current directory?

Reply to the comments

I open a new tab by a keyboard shortcut that triggers Create new {Ubuntu} console command or just click the + icon. I configured Ubuntu task as default.

4
  • How do you open new tab?
    – Maximus
    Commented Jun 27, 2021 at 17:35
  • I spent a bit looking into this. What I think you are asking for is for your first tab to open to ~, but then subsequent tabs/sessions to use the current directory of the current tab? I looked at the ConEmu docs for a bit, and I didn't see any obvious way to do this. The docs even say that it is challenging to get the current directory from a WSL session. You have to hook your PS1 (prompt) to send a message back up to ConEmu. Then you are still left with the "conditional" of determining if you are opening the first tab or a subsequent one, and I didn't see a way to do that. Commented Jun 28, 2021 at 16:26
  • @Maximus I added info to my question.
    – ironsand
    Commented Jun 28, 2021 at 18:44
  • Yes, that is what I wanted. If I add another condition, when I use different shell in current tab, I want to open Ubuntu home dir. So it seems quite difficult now, I gonna use cd command after I open a new session. Thanks.
    – ironsand
    Commented Jun 28, 2021 at 18:48

0

You must log in to answer this question.

Browse other questions tagged .