]> git.r.bdr.sh - rbdr/dotfiles/blame - zsh/modules/prompt.zsh
Update karabiner
[rbdr/dotfiles] / zsh / modules / prompt.zsh
CommitLineData
fa250235
BB
1autoload -Uz promptinit && promptinit
2
3if [[ "$TERM" == (dumb|linux|*bsd*) ]] || (( $#prompt_argv < 1 )); then
4 prompt 'off'
5fi
6
fa250235
BB
7#
8# ZLE widgets
9#
10
a40a5ec5 11function zle-line-init zle-keymap-select {
ec48932f
BB
12
13 # Couldn't figure out how to get tmux and iTerm to agree on how to render
14 # these characters... so there you go.
15
64c29a52
RBR
16 local normal_symbol="N"
17 local insert_symbol="I"
18 local error_symbol="X"
ec48932f
BB
19
20 # Show vi status / return status on the right side
21
22 local return_status="%{%F{red}%}%(?.. $error_symbol)%{$reset_color%}"
fa250235 23 if [ $KEYMAP = 'vicmd' ]; then
ec48932f 24 local edit_status="%{%F{cyan}%}$normal_symbol"
fa250235 25 else
ec48932f 26 local edit_status="%{%F{green}%}$insert_symbol"
fa250235
BB
27 fi
28
ec48932f 29 RPROMPT="${edit_status}${return_status}%{$reset_color%}"
a40a5ec5
BB
30 zle reset-prompt
31}
32zle -N zle-line-init
33zle -N zle-keymap-select
34
fa250235
BB
35#
36# Setup Prompt
37#
38
39function prompt_setup {
a40a5ec5
BB
40 setopt LOCAL_OPTIONS
41 unsetopt XTRACE KSH_ARRAYS
42 prompt_opts=(cr percent subst)
43
44 # Load required functions.
45 autoload -Uz add-zsh-hook
46
a40a5ec5
BB
47 # Define prompts.
48 PROMPT='
6f7715ef 49%{%F{black}%}$(env_info) $(node_info) $(rust_info) $(python_info)
b6bcca60 50%{%F{magenta}%}%n%{%f%}@%{%F{yellow}%}$(hostname -s)%{%f%} %{%B%F{green}%}${PWD/#$HOME/~}%{%f%b%}$(git_info)%{%f%}
6f7715ef 51%(?,,%{${%B%F{white}%}[%?]%{%f%b%} )%% '
a40a5ec5
BB
52}
53
fa250235
BB
54prompt_setup "$@"
55setopt PROMPT_SUBST
ec48932f
BB
56setopt PROMPT_PERCENT
57setopt TRANSIENT_RPROMPT