mbenv/config_in/fish/functions/fish_mode_prompt.fish

49 lines
1.4 KiB
Fish
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Display the current binding mode... if it's vi or vi-like.
#
# To always show the binding mode (regardless of current bindings):
# set -g theme_display_vi yes
#
# To never show:
# set -g theme_display_vi no
# invisible space is inserted into prompt to play nice with tmux jumping
# https://unix.stackexchange.com/questions/226731/jump-to-last-prompt-in-terminal-or-tmux
set -g invisible_space " "
function fish_mode_prompt -d 'bobthefish-optimized fish mode indicator'
[ "$theme_display_vi" != 'no' ]
or return
[ "$fish_key_bindings" = 'fish_vi_key_bindings' \
-o "$fish_key_bindings" = 'hybrid_bindings' \
-o "$fish_key_bindings" = 'fish_hybrid_key_bindings' \
-o "$theme_display_vi" = 'yes' ]
or return
__bobthefish_colors $theme_color_scheme
type -q bobthefish_colors
and bobthefish_colors
set_color normal # clear out anything bold or underline...
switch $fish_bind_mode
case default
set_color -b $color_vi_mode_default
echo -n " N$invisible_space"
case insert
set_color -b $color_vi_mode_insert
echo -n " I$invisible_space"
case replace_one replace-one
set_color -b $color_vi_mode_insert
echo -n " R$invisible_space"
case visual
set_color -b $color_vi_mode_visual
echo -n " V$invisible_space"
end
set_color normal
end