How to get absolute path on a zsh prompt? -


i'm switching bash zsh.

i want update new zsh prompt , looked around find way, have found "solutions" via oh-my-zsh.

the goal:

location: ~/dir_1/dir_1_1/dir_1_1_1 

what have:

location: dir_1_1_1 

the code (source):

 ps1='${ssh_connection+"%{$fg_bold[green]%}%n@%m:"}%{$fg_bold[green]%}location: %c%{$reset_color%}$(git_prompt_info) ' 

as horacio chavez mentioned in comment above, want here: http://zsh.sourceforge.net/doc/release/prompt-expansion.html details on how change displayed path in zsh.

in case if looking path relative home folder, include %~ in zsh-theme file. prompt this:

ps1='${ssh_connection+"%{$fg_bold[green]%}%n@%m:"}%{$fg_bold[green]%}location: %~%{$reset_color%}$(git_prompt_info) ' 

note, changed 1 character in prompt. %c swapped %~. %c give current directory (see document link above, or here)

for full path use %/


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -