From e102187d33fb5ee21ca9d6d2cf50f5f2404e8050 Mon Sep 17 00:00:00 2001 From: Andrew Guschin Date: Sun, 20 Feb 2022 10:06:42 +0400 Subject: Changed zsh prompt --- .zshrc | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to '.zshrc') diff --git a/.zshrc b/.zshrc index 152b0f1..e4f03ea 100644 --- a/.zshrc +++ b/.zshrc @@ -13,10 +13,7 @@ fi alias la='ls -lhFA' alias ll='ls -lhF' alias l='ls -CF' -alias dotfiles="/usr/bin/git --git-dir='$HOME/.dotfiles' --work-tree='$HOME'" -alias dotstat="/usr/bin/git --git-dir='$HOME/.dotfiles' --work-tree='$HOME' status" -alias dotdiff="/usr/bin/git --git-dir='$HOME/.dotfiles' --work-tree='$HOME' diff" -alias dotadd="/usr/bin/git --git-dir='$HOME/.dotfiles' --work-tree='$HOME' add -f" +alias dot="/usr/bin/git --git-dir='$HOME/.dotfiles' --work-tree='$HOME'" alias e="$EDITOR" # XDG aliases @@ -32,22 +29,30 @@ setopt extendedglob nomatch unsetopt autocd beep bindkey -e autoload -Uz compinit +zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' compinit -d $XDG_CACHE_HOME/zsh/zcompdump +# Load version control information +autoload -Uz vcs_info +precmd() { vcs_info } + +# Format the vcs_info_msg_0_ variable +zstyle ':vcs_info:git:*' formats ' (%b)' + cdf() { cd "$(find ~ -type d &>/dev/null | fzf)" } -set_ps1() { - # red color if current user us root, otherwise - green +set_prompt() { + # red color if current user is root, otherwise - green [ "$USER" = "root" ] && UCOLOR="%B%F{red}" || UCOLOR="%B%F{green}" [ "$USER" = "root" ] && END="#" || END="$" BLUE="%B%F{blue}" PURPLE="%B%F{magenta}" STOP="%f%b" - export PS1="%T $UCOLOR%n$STOP@$PURPLE%m$STOP:$BLUE%~$STOP $END " + setopt PROMPT_SUBST + PROMPT='%T $UCOLOR%n$STOP@$PURPLE%m$STOP:$BLUE%~$STOP${vcs_info_msg_0_}'$'\n''$END ' } - -set_ps1 +set_prompt fortune -s | cowsay -- cgit v1.2.3