[英]zsh show current dir if not home on MacOS
How to tell the prompt to show the current directory only and only show ~
if at $HOME:如何告诉提示仅显示当前目录并且仅在 $HOME 时显示~
:
I've looked and I know I can do:我看过,我知道我可以做到:
PS1="%~"
to show the path or only ~
if at home but it'll show full path if in another folder like: ~/somefolder/anotherfolder $
PS1="%~"
显示路径或仅显示~
如果在家里,但如果在另一个文件夹中,它将显示完整路径: ~/somefolder/anotherfolder $
PS1="%1d"
to show only the current dir but if at home, it'll show my username folder like user@machine:userfolder $
and I want this user@namchine:~ $
PS1="%1d"
仅显示当前目录,但如果在家里,它将显示我的用户名文件夹,如user@machine:userfolder $
我想要这个user@namchine:~ $
Have you tried this:你有没有试过这个:
PS1="%1~"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.