English 中文(简体)
如何迅速走上绝对的道路?
原标题:How to get absolute path on a zsh prompt?
  • 时间:2016-01-06 00:57:42
  •  标签:
  • zsh

I m 转而从ash子到z。

我希望更新我的新的奇迹,并寻找办法,但我只是通过oh子找到了“解决办法”。

www.un.org/Depts/DGACM/index_spanish.htm 目标:

Location: ~/dir_1/dir_1_1/dir_1_1_1

www.un.org/Depts/DGACM/index_spanish.htm 我拥有:

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)  
最佳回答

http://stackoverflow.com/users/3043906/horacio-chavez” http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html。

在此情况下,如果你在寻找一条与你的双亲相对的道路,则在你的主题档案中加入%~。 阁下现在希望:

PS1= ${SSH_CONNECTION+"%{$fg_bold[green]%}%n@%m:"}%{$fg_bold[green]%}Location: %~%{$reset_color%}$(git_prompt_info)  

请注意,我只是迅速改变一个特点。 <代码>%c被转换为%~ rel=“noreferer”>,见以上文件链接,或

全文请上%/

问题回答

迅速增加双管干道的简单途径。 在<代码>~/zshrc上添加:

setopt PROMPT_SUBST
PROMPT= %n@%m: ${(%):-%~}  

部分途径是<代码>{>((%):-%~}。 可以按照你的生活方式增加颜色:

<代码>出口 缩略语

Just append above code into .zshrc and source again.

因为代表姓名的比例和百分比是完全的。





相关问题
zsh alias -> function?

Suppose I have: alias gg="git grep" then stuff like: gg "int x" works, but gg int x gets complaints. Is there a way to rewrite gg as a function in zsh so that it takes all the arguments after ...

zsh handling of arguments

In the zsh programming language, how do I get the entire list of arguments as a string in "" ? i.e. in myzshcommand 1 2 3 foo bar I want something to match me "1 2 3 foo bar" Thanks!

Tell if a user has SUed in a shell script?

I have a script which executes a git-pull when I log in. The problem is, if I su to a different user and preserve my environment with an su -lp, the script gets run again and usually gets messed up ...

How do I require a minimum version of zsh?

I want to use a feature only present in newer versions of zsh: [[ "$foo" =~ "regexp" ]] where regexp is a regular expression. Is it possible to do this check? Something like: if [[ $ZSH_VERSION &...

Rename files based on sorted creation date?

I have a directory filled with files with random names. I d like to be able to rename them file 1 file 2 etc based on chronological order, ie file creation date. I could be writing a short Python ...

ZSH Prompt/RPrompt Conflict

I currently have my ZSH PROMPT variable set up as: PROMPT=$ [%{e[0;32m%}%n@%m:%~%{e[0m%}]> and my RPROMPT variable as: RPROMPT=$ [%{e[0;32m%}%Te[0m%}] The effect I m working for is to make ...

热门标签