]> git.r.bdr.sh - rbdr/dotfiles/blame_incremental - zsh/modules/prompt.zsh
Update karabiner
[rbdr/dotfiles] / zsh / modules / prompt.zsh
... / ...
CommitLineData
1autoload -Uz promptinit && promptinit
2
3if [[ "$TERM" == (dumb|linux|*bsd*) ]] || (( $#prompt_argv < 1 )); then
4 prompt 'off'
5fi
6
7#
8# ZLE widgets
9#
10
11function zle-line-init zle-keymap-select {
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
16 local normal_symbol="N"
17 local insert_symbol="I"
18 local error_symbol="X"
19
20 # Show vi status / return status on the right side
21
22 local return_status="%{%F{red}%}%(?.. $error_symbol)%{$reset_color%}"
23 if [ $KEYMAP = 'vicmd' ]; then
24 local edit_status="%{%F{cyan}%}$normal_symbol"
25 else
26 local edit_status="%{%F{green}%}$insert_symbol"
27 fi
28
29 RPROMPT="${edit_status}${return_status}%{$reset_color%}"
30 zle reset-prompt
31}
32zle -N zle-line-init
33zle -N zle-keymap-select
34
35#
36# Setup Prompt
37#
38
39function prompt_setup {
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
47 # Define prompts.
48 PROMPT='
49%{%F{black}%}$(env_info) $(node_info) $(rust_info) $(python_info)
50%{%F{magenta}%}%n%{%f%}@%{%F{yellow}%}$(hostname -s)%{%f%} %{%B%F{green}%}${PWD/#$HOME/~}%{%f%b%}$(git_info)%{%f%}
51%(?,,%{${%B%F{white}%}[%?]%{%f%b%} )%% '
52}
53
54prompt_setup "$@"
55setopt PROMPT_SUBST
56setopt PROMPT_PERCENT
57setopt TRANSIENT_RPROMPT