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

ConEmu doesn't start new shell in same directory when duplicating tab #1526

Closed
ebugusey opened this issue Apr 24, 2018 · 10 comments
Closed

ConEmu doesn't start new shell in same directory when duplicating tab #1526

ebugusey opened this issue Apr 24, 2018 · 10 comments

Comments

@ebugusey
Copy link

ebugusey commented Apr 24, 2018

Versions

ConEmu build: 180422 x64
OS version: Windows 8.1 x64
Used shell version (Far Manager, git-bash, cmd, powershell, cygwin, whatever): git-bash, msys2, powershell

Problem description

In Duplicate root... command description it says:

Duplicate tab with current state of root process

But it doesn't do what it says.

Steps to reproduce

  1. Set up shell profile as described in documentation for either shell.
  2. Start up shell.
  3. cd to another directory.
  4. Call Duplicate root... command.

Actual results

Shell starts in starting directory.

Expected results

Shell starts in directory of duplicated shell.

Additional files

Settings and whatever.

@ebugusey ebugusey changed the title ConEmu doesn't duplicate tab as it supposed to ConEmu doesn't start new shell in same directory when duplicating tab Apr 24, 2018
@Maximus5
Copy link
Owner

Shell working directory

@ebugusey
Copy link
Author

ebugusey commented Apr 25, 2018

Read your own documentation, mate. And my steps. Especially this line:

Set up shell profile as described in documentation for either shell.

Read very carefully because this link goes to this EXACT page you are referring.
I HAVE set up shell as described in your link. ConEmu SHOULD track current directory, but it does not!

@Maximus5
Copy link
Owner

Your description is rather abstract. What shell are you trying? What exact steps have you made to configure it?

@Maximus5
Copy link
Owner

Just rechecked and Duplicate starts new cmd shell in proper folder.

@ebugusey
Copy link
Author

ebugusey commented Apr 25, 2018

I have tried in git-bash without connector, msys2 with connector and powershell. Also mentioned them in my issue description.
I have set up this shells as described in documentation.

For git-bash in ~/.bash_profile:

if [[ -n "${ConEmuPID}" ]]; then
  PROMPT_COMMAND='ConEmuC -StoreCWD'
fi

For msys2 in ~/.bash_profile:

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

For powershell in %UserProfile%\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:

function ANSI () {
    $ESC = [char]27
    
    $ST = "$ESC\"
    
    $reset   = "$ESC[m"
    $black   = "$ESC[30m"
    $red     = "$ESC[31m"
    $green   = "$ESC[32m"
    $yellow  = "$ESC[33m"
    $blue    = "$ESC[34m"
    $magenta = "$ESC[35m"
    $cyan    = "$ESC[36m"
    $white   = "$ESC[37m"

    $CWD   = "$ESC]9;9;"
    $Title = "$ESC]0;"
}

function IsConEmu () {
    $exitcode = 0;
    try {
        & ConEmuC.exe --% /IsConEmu
        $exitcode = $LASTEXITCODE
    }
    catch [System.Management.Automation.CommandNotFoundException] {
        $exitcode = 2;
    }

    $IsConEmu = $exitcode -eq 1

    return $IsConEmu
}

function prompt () {

    if (IsConEmu) {
        . ANSI

        $prompt = `
            "${Title}PS $PWD${ST}" + `
            "${CWD}$PWD${ST}" + `
            "${reset}" + `
            "${green}$env:USERNAME@$env:COMPUTERNAME ${yellow}$PWD`n" + `
            "${reset}`$ "
    } else {
        $prompt = `
            "PS $PWD`n" + `
            '$ '
    }

    return $prompt
}

@ebugusey
Copy link
Author

Just checked cmd.exe. In cmd.exe it works, yes. But I don't use this thing.

@Maximus5
Copy link
Owner

And how do you run these shells?

As you said, it works with cmd, that means if ConEmu able to know shell CD, things work.

So, it is either your shell doesn't report CD to ConEmu (easy to check with tab templates or even via "Restart..." dialog),
Or your shell changes the directory to certain fixed folder after start.

Neither of these is related to ConEmu, just config of your shell.

@ebugusey
Copy link
Author

ebugusey commented Apr 27, 2018

Do you have problems with reading comprehension?
I JUST POSTED HOW I CONFIGURED PROFILES FOR MY SHELLS.
As in your documentation https://conemu.github.io/en/ShellWorkDir.html#What_you_shall_do_to_get_CD_support.
I HAVE DONE THAT.
But ConEmu still doesn't track CD.

There https://conemu.github.io/en/ShellWorkDir.html#connector-ps1
For msys2 in ~/.bash_profile:

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

One of the examples. If you even read what I post you will see that I already posted that. Fuck, man. What is wrong with you?

@Maximus5
Copy link
Owner

What's wrong with you? Do you really think the rudeness helps???

@Maximus5
Copy link
Owner

Do you have problems with reading comprehension?

I've asked you

easy to check with tab templates or even via "Restart..." dialog

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