Last active
November 26, 2018 22:18
-
-
Save francoiscampbell/2013cface8543c9cc40d3e93895a2e6e to your computer and use it in GitHub Desktop.
Moves the cwd to the RPROMPT and only shows the final path component (rprompt_segment taken from https://gist.github.com/rjorgenson/83094662ace4d3b82b95)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prompt_context() { | |
} | |
prompt_dir () { | |
prompt_segment blue black '$' | |
} | |
RSEGMENT_SEPARATOR="\ue0b2" | |
rprompt_segment() { | |
local bg fg | |
[[ -n $1 ]] && bg="%K{$1}" || bg="%k" | |
[[ -n $2 ]] && fg="%F{$2}" || fg="%f" | |
if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then | |
echo -n " %{%K{$CURRENT_BG}%F{$1}%}$RSEGMENT_SEPARATOR%{$bg%}%{$fg%} " | |
else | |
echo -n "%F{$1}%{%K{default}%}$RSEGMENT_SEPARATOR%{$bg%}%{$fg%} " | |
fi | |
CURRENT_BG=$1 | |
[[ -n $3 ]] && echo -n $3 | |
} | |
rprompt_dir () { | |
RPROMPT=$(rprompt_segment blue black '%1~ ') | |
} | |
autoload -U add-zsh-hook | |
add-zsh-hook precmd rprompt_dir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment