问题
I'm usually running Git Bash in ConEmu tabs. It would be really handy to show the name of the current directory in the tab bar for each instance of Git Bash, but if I set the tab template to %d
or %f
, I always get my Windows home directory, no matter where I cd
to in Git Bash.
Is there a way to display the path in the tab bar? As you can see from the attached screenshot, I'm navigated to the banana
folder, but ccook
(my home dir) is shown in the tab.
The Title (%s
) seems to contain the full path, but that's too long for my tabs.
The best I'm currently able to achieve is to use %s
and add MINGW64
as a Skipped word from title, but that still gets me the full path instead of just the current folder. If there was a way to specify a regex I could exclude everything but the text after the final /
.
回答1:
For Cygwin users, add PROMPT_COMMAND='ConEmuC -StoreCWD'
to the .bashrc.
Per suggestion from @Jeffrey-Harmon
if [[ -n "${ConEmuPID}" ]]; then
PROMPT_COMMAND='ConEmuC -StoreCWD'
fi
edit:
Looking at the documentation page, this suggestion is there as well now.
https://conemu.github.io/en/ShellWorkDir.html#bash_and_other_cygwin_shells
来源:https://stackoverflow.com/questions/39896401/conemu-with-git-bash-show-folder-in-tab-bar