fish-shell/share/functions/fish_mode_prompt.fish
ridiculousfish 767742c7e7 Rework how the mode is reported in fish_vi_mode
Add a new function fish_mode_prompt which (if it is defined) has its output
prepended to the left prompt. Rather than replacing the prompt wholesale, make
fish_vi_mode enable this function by setting a variable __fish_vi_mode. This
enables vi mode to interoperate nicely with custom prompts. Users who want
to change how the mode is reported can either redefine this function or
erase it entirely. Fixes #1988.
2015-06-14 11:36:11 -07:00

19 lines
531 B
Fish

# The fish_mode_prompt function is prepended to the prompt
function fish_mode_prompt --description "Displays the current mode"
# Do nothing if not in vi mode
if set -q __fish_vi_mode
switch $fish_bind_mode
case default
set_color --bold --background red white
echo '[N]'
case insert
set_color --bold --background green white
echo '[I]'
case visual
set_color --bold --background magenta white
echo '[V]'
end
set_color normal
echo -n ' '
end
end