git-aware-prompt icon indicating copy to clipboard operation
git-aware-prompt copied to clipboard

Not show path tittle terminer

Open khanhtran94 opened this issue 6 years ago • 6 comments

When use PS1 = export PS1="${debian_chroot:+($debian_chroot)}[\033[01;32m]\u@\h[\033[00m]:[\033[01;34m]\w[\033[00m] [$txtcyn]$git_branch[$txtred]$git_dirty[$txtrst]$ " below bashrc, Teminer lose path folder lose notlose

khanhtran94 avatar Jun 26 '18 02:06 khanhtran94

Use echo "$PS1" | vi -R - to find out what your PS1 was before you set it.

You will probably find a hidden code in your original PS1 which sends a message to the terminal about the current folder.

Copy that code into the new PS1 and you can have both.

joeytwiddle avatar Jun 27 '18 09:06 joeytwiddle

here is ps1 when i use echo "$PS1" | vi -R -

#export PS1="${debian_chroot:+($debian_chroot)}[\033[01;32m]\u@\h[\033[00m]:[\033[01;34m]\w[\033[00m] [^[[36m]$git_branch[^[[31m]$git_dirty[^[(B^[[0m]$"

It have error "[^[[36m] ^[[31m][^[(B^[[0m]".

khanhtran94 avatar Jul 03 '18 00:07 khanhtran94

terminr

khanhtran94 avatar Jul 03 '18 00:07 khanhtran94

That's not an error, but ^[ is the escape character, not literally ^[. You can probably replace it with \033 or \x1b, although it might depend on your exact shell/version.

lethosor avatar Jul 03 '18 01:07 lethosor

What you showed above is PS1 after you set it for git-aware-prompt.

You need to find the value of PS1 before it was changed. (When it still has the folder-in-title feature that you want.)

Then you need to combine the old PS1 with git-aware-prompt's PS1, since you want to have both features.

joeytwiddle avatar Jul 03 '18 05:07 joeytwiddle

PS1="[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a]$PS1[$txtcyn]$git_branch[$txtred]$git_dirty[$txtrst]$"

this is my PS1, for those who have some issue

khanhtran94 avatar Jul 05 '18 11:07 khanhtran94