zsh: named dirs shouldn't be with prompt
This commit is contained in:
parent
523c8f4742
commit
9322d6bbe8
15
zsh/.zshrc
15
zsh/.zshrc
|
@ -51,6 +51,13 @@ alias copy='clip'
|
||||||
alias code='code -r'
|
alias code='code -r'
|
||||||
function mkcd { mkdir -p $1 && cd $1 }
|
function mkcd { mkdir -p $1 && cd $1 }
|
||||||
|
|
||||||
|
# Set named directories to shorten path display on non-remote systems
|
||||||
|
if [ -z "$is_remote" ]; then
|
||||||
|
hash -d gh=~/src/github.com
|
||||||
|
hash -d gl=~/src/gitlab.com
|
||||||
|
hash -d gist=~/src/gist.github.com
|
||||||
|
fi
|
||||||
|
|
||||||
# Prompt stuff
|
# Prompt stuff
|
||||||
setopt PROMPT_SUBST
|
setopt PROMPT_SUBST
|
||||||
|
|
||||||
|
@ -60,7 +67,6 @@ if [ -n "$IS_REMOTE_SESSION" ] || [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; the
|
||||||
else
|
else
|
||||||
is_remote=
|
is_remote=
|
||||||
fi
|
fi
|
||||||
# export is_remote
|
|
||||||
export IS_REMOTE_SESSION=$is_remote
|
export IS_REMOTE_SESSION=$is_remote
|
||||||
|
|
||||||
# Function to get the current branch name
|
# Function to get the current branch name
|
||||||
|
@ -68,13 +74,6 @@ function parse_git_branch {
|
||||||
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' -e 's/((/(/' -e 's/))/)/'
|
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' -e 's/((/(/' -e 's/))/)/'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set named directories to shorten path display on non-remote systems
|
|
||||||
if [ -z "$is_remote" ]; then
|
|
||||||
hash -d gh=~/src/github.com
|
|
||||||
hash -d gl=~/src/gitlab.com
|
|
||||||
hash -d gist=~/src/gist.github.com
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Prompt shows hostname if connected to a remote or if root
|
# Prompt shows hostname if connected to a remote or if root
|
||||||
PROMPT="%B$([ -n "$is_remote" ] || [ "$EUID" = 0 ] && echo "%F{magenta}%m%f ")%F{$([ "$EUID" = 0 ] && echo "red" || echo "cyan")}%n%f %F{blue}%~%f%b\$(parse_git_branch) %B%#%b "
|
PROMPT="%B$([ -n "$is_remote" ] || [ "$EUID" = 0 ] && echo "%F{magenta}%m%f ")%F{$([ "$EUID" = 0 ] && echo "red" || echo "cyan")}%n%f %F{blue}%~%f%b\$(parse_git_branch) %B%#%b "
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue