From 63901a69beaf0ff1523f1817da50a187ceb25ad7 Mon Sep 17 00:00:00 2001 From: Daniel Holman Date: Thu, 1 Mar 2018 12:18:47 -0600 Subject: Made .zshrc a little clearer and more useful Inserted comments above large blocks of shell config and changed the prompt to also print the return code of the last command to the left of the prompt --- .zshrc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.zshrc b/.zshrc index 19ec142..91f1569 100644 --- a/.zshrc +++ b/.zshrc @@ -13,6 +13,9 @@ autoload -Uz compinit compinit # End of lines added by compinstall +# Additional colors +autoload -U colors %% colors + # Additional completion options zstyle ':completion:*' use-cache on zstyle ':completion:*:cd:*' ignore-parents parent pwd @@ -23,6 +26,7 @@ zstyle ':completion:*:*:kill:*' menu yes select zstyle ':completion:*:kill:*' force-list always zstyle ':completion:*' squeeze-slashes true +# Useful scripts source /usr/share/doc/pkgfile/command-not-found.zsh source /usr/share/git/completion/git-prompt.sh source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh @@ -32,13 +36,15 @@ source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring bindkey -M vicmd 'k' history-substring-search-up bindkey -M vicmd 'j' history-substring-search-down +# Aliases alias ls="ls --color=auto" alias pacin="pacaur -S" alias pacr="pacaur -Rns" alias pacup="pacaur -Syu" alias pacsearch="pacaur -Ss" -alias msfconsole="msfconsole --quiet -x \"db_connect ${USER}@msf\"" +alias msfconsole="sudo msfconsole --quiet -x \"db_connect root@msf\"" +# Important vars export PATH="$PATH:/home/dholman/bin" export EDITOR="vim" export SUDO_EDITOR="vim" @@ -46,11 +52,13 @@ export SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0 export GPGKEY=90D8F8E2C830F6129B2FBB1133836B30AA014B82 export GPG_TTY=$(tty) +# Prompt settings +local return_code="%(?..%{$fg[red]%}%? ${exclaim}%{$reset_color%})" setopt PROMPT_SUBST GIT_PS1_SHOWUPSTREAM=auto GIT_PS1_SHOWDIRTYSTATE=1 GIT_PS1_SHOWUNTRACKEDFILES=1 -PS1='$(__git_ps1 "(%s)")\$ ' +PS1='${return_code}$(__git_ps1 "(%s)")$ ' # Make shell stuff behave nicely man() { -- cgit v1.2.3