X-Git-Url: https://git.r.bdr.sh/rbdr/dotfiles/blobdiff_plain/fab93d61dc5d1cb52f6e3e83a99fc0aeaa2cb29a..967de9a270bccf66da73eda4e17d78d41c4e14d6:/zsh/modules/prompt.zsh?ds=inline diff --git a/zsh/modules/prompt.zsh b/zsh/modules/prompt.zsh index 2b7454d..615ca95 100644 --- a/zsh/modules/prompt.zsh +++ b/zsh/modules/prompt.zsh @@ -4,47 +4,6 @@ if [[ "$TERM" == (dumb|linux|*bsd*) ]] || (( $#prompt_argv < 1 )); then prompt 'off' fi -# -# Precmd -# - -function prompt_precmd { - git-info -} - -# -# Functions -# - -function env_info_provider() { echo "%{%F{green}%}n/a"; } -function env_info { - echo "[%{%F{cyan}%}ENV%{%F{black}%} $(env_info_provider)%{%F{black}%}]" -} - -function python_info { - pythoninfo=`asdf current python | sed 's/ */ /g' | cut -d ' ' -f 2` - if [[ -z "$VIRTUAL_ENV" ]]; then - venv="default" - else - venv="${VIRTUAL_ENV##*/}" - fi - echo "%{%F{green}%}py%{%F{black}%} ${pythoninfo}@${venv}" -} - -function ruby_info { - rubyinfo=`asdf current ruby | sed 's/ */ /g' | cut -d ' ' -f 2` - echo "%{%F{red}%}rb%{%F{black}%} ${rubyinfo}" -} - -function node_info { - nodeinfo=`asdf current nodejs | sed 's/ */ /g' | cut -d ' ' -f 2` - echo "%{%F{yellow}%}js%{%F{black}%} ${nodeinfo}" -} - -function box_name { - [ -f ~/.box-name ] && cat ~/.box-name || hostname -s -} - # # ZLE widgets # @@ -85,24 +44,11 @@ function prompt_setup { # Load required functions. autoload -Uz add-zsh-hook - # Add hook for calling git-info before each command. - add-zsh-hook precmd prompt_precmd - - # Set git-info parameters. - zstyle ':git:info' verbose 'no' - zstyle ':git:info:branch' format '@%F{cyan}%b%f' - zstyle ':git:info:clean' format '' - zstyle ':git:info:added' format '%{%F{green}%}!' - zstyle ':git:info:modified' format '%{%F{green}%}?' - zstyle ':git:info:untracked' format '%{%F{magenta}%}?' - zstyle ':git:info:keys' format \ - 'prompt' '%b%a%m%u' - # Define prompts. PROMPT=' -%{%F{black}%}$(env_info) $(node_info) $(ruby_info) $(python_info) -%{%F{magenta}%}%n%{%f%}@%{%F{yellow}%}$(box_name)%{%f%} %{%B%F{green}%}${PWD/#$HOME/~}%{%f%b%}${git_info[prompt]} %{%f%} -%(?,,%{${%B%F{white}%}[%?]%{%f%b%} )$ ' +%{%F{black}%}$(env_info) $(node_info) $(rust_info) $(python_info) +%{%F{magenta}%}%n%{%f%}@%{%F{yellow}%}$(hostname -s)%{%f%} %{%B%F{green}%}${PWD/#$HOME/~}%{%f%b%}$(git_info)%{%f%} +%(?,,%{${%B%F{white}%}[%?]%{%f%b%} )%% ' } prompt_setup "$@"