Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ~/.zprompt
- function zprompt_user() {
- if [[ $UID == '0' ]]; then
- echo '#'
- else
- echo '$'
- fi
- }
- function zprompt_pwd() {
- echo "%~"
- }
- function zprompt_git_status() {
- local git_status=$(git status --porcelain 2> /dev/null)
- [[ ! -z $git_status ]] && echo '*'
- }
- function zprompt_context() {
- [[ -n $SSH_TTY ]] || [[ -n $SSH_CLIENT ]] && echo '%n@%m'
- }
- function zprompt_git_branch() {
- local branch=$(git symbolic-ref HEAD --short 2> /dev/null)
- [[ -n $branch ]] && echo " $branch "
- }
- setopt prompt_subst
- PROMPT='$(zprompt_context)'
- PROMPT+='$(zprompt_pwd)'
- PROMPT+='$(zprompt_git_branch)'
- PROMPT+='$(zprompt_git_status)'
- PROMPT+=' $(zprompt_user) '
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement