diff options
Diffstat (limited to '.config')
-rw-r--r-- | .config/zsh/.zshrc | 24 | ||||
-rw-r--r-- | .config/zsh/prompt.zsh | 24 |
2 files changed, 25 insertions, 23 deletions
diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 404bbc7..396eec9 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -108,29 +108,7 @@ function spacetotab () { mv "$1.tmp" "$1" } -# prompt -# TODO maybe just use someone else's theme altogether -# TODO location should control its length a little better -# TODO only color the last segment of the path (pwd) -setopt prompt_subst -autoload -Uz vcs_info -zstyle ':vcs_info:*' enable git -zstyle ':vcs_info:*' actionformats '%F{purple}[%F{green}%b%F{olive}|%F{red}%a%F{purple}]%f ' -zstyle ':vcs_info:*' formats '%F{purple}[%F{green}%b%F{purple}]%f ' -precmd () { - [[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" == "true" ]] && vcs_info || vcs_info_msg_0_="" -} - -user="%n" -if [[ -n "$SSH_CLIENT" || "$USER" == "root" ]]; then - user+="@%M" -fi -last_status="%(?.%F{green}%#.%F{red}%?)%f" -location="%F{blue}%3~%f" -PROMPT="[$user:$location] "'${vcs_info_msg_0_}'"${last_status} " -unset user -unset last_status -unset location +source $ZDOTDIR/prompt.zsh # display a fortune when opening an interactive terminal tty -s && fortune $HOME/fortunes 2>/dev/null ||: diff --git a/.config/zsh/prompt.zsh b/.config/zsh/prompt.zsh new file mode 100644 index 0000000..81e3664 --- /dev/null +++ b/.config/zsh/prompt.zsh @@ -0,0 +1,24 @@ +# prompt +# TODO maybe just use someone else's theme altogether +# TODO location should control its length a little better +# TODO only color the last segment of the path (pwd)? +setopt prompt_subst + +autoload -Uz vcs_info +zstyle ':vcs_info:*' enable git +zstyle ':vcs_info:*' actionformats '%F{purple}[%F{green}%b%F{olive}|%F{red}%a%F{purple}]%f ' +zstyle ':vcs_info:*' formats '%F{purple}[%F{green}%b%F{purple}]%f ' +precmd () { + [[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" == "true" ]] && vcs_info || vcs_info_msg_0_="" +} + +user="%n" +if [[ -n "$SSH_CLIENT" || "$USER" == "root" ]]; then + user+="@%M" +fi +last_status="%(?.%F{green}%#.%F{red}%?)%f" +location="%F{blue}%3~%f" +PROMPT="[$user:$location] "'${vcs_info_msg_0_}'"${last_status} " +unset user +unset last_status +unset location |