mirror of
https://github.com/tomru/DotfilesOld.git
synced 2026-03-03 06:27:21 +01:00
fiddling with own prompt
This commit is contained in:
@@ -1,9 +1,21 @@
|
||||
# modify the prompt to contain git branch name if applicable
|
||||
git_prompt_info() {
|
||||
current_branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null)
|
||||
if [[ -n $current_branch ]]; then
|
||||
echo " %{$fg_bold[green]%}$current_branch%{$reset_color%}"
|
||||
autoload -Uz vcs_info
|
||||
|
||||
zstyle ':vcs_info:*' enable git
|
||||
precmd() {
|
||||
vcs_info
|
||||
}
|
||||
|
||||
setopt promptsubst
|
||||
|
||||
last_exit_code() {
|
||||
echo "%{$fg[red]%}%(?..[%?] )%{$reset_color%}"
|
||||
}
|
||||
|
||||
user_on_host() {
|
||||
if [[ -n $SSH_CONNECTION ]]; then
|
||||
echo "%{$fg_bold[yellow]%}%n@%m%{$reset_color%}"
|
||||
fi
|
||||
}
|
||||
setopt promptsubst
|
||||
PS1='${SSH_CONNECTION+"%{$fg_bold[green]%}%n@%m:"}%{$fg_bold[blue]%}%c%{$reset_color%}$(git_prompt_info) %# '
|
||||
|
||||
PS1='$(user_on_host)% > '
|
||||
RPS1='$(last_exit_code) %{$fg_bold[yellow]%}${vcs_info_msg_0_}%{$reset_color%}%{$fg_bold[blue]%}%~%{$reset_color%}'
|
||||
|
||||
Reference in New Issue
Block a user