
zsh가 프롬프트를 전체 경로로 설정할 수 있습니까?제외하고현재 디렉토리? 즉, ~/a/b/c/
그냥 ~/a/b/
?
~/a/b/c
왼쪽 및 오른쪽 프롬프트를 사용하여 이 결과를 얻으려고 합니다 .
c/: | ~/a/b/
내 현재 복제와는 반대로 c
:
c/: | ~/a/b/c/
c
디렉토리 이름이 길면 중복으로 인해 공간이 낭비됩니다 .
에서수동내가 원하는 것 이외의 모든 것을 찾았습니다.
%-1~
- 경로의 첫 번째 요소%1~
- 경로의 마지막 요소
마지막을 제외한 모든 대신
어떻게 할 수 있나요?
답변1
# Before printing each prompt string, apply substitutions to it.
setopt promptsubst
# $PWD is always equal to the present working dir.
# :h chops off the last item of the path.
# (D) substitutes the start of the path with a named dir, such as ~, if possible.
# Note that this string is in 'single quotes'!
RPS1='${(D)PWD:h}'
짜잔!
선적 서류 비치: