Update vi mode prompt.

* Default to showing vi mode prompt (if the current bind mode is vi). Allow overriding by setting it `theme_display_vi` to `no`.

* Remove `theme_display_vi_hide_mode`, because I don't like the prompt jumping around when changing modes.

* Override `fish_mode_prompt` because we're already handling it inside `fish_prompt`. Add a note so future code archeologists can figure out how to override.

* Add support for `replace-one` bind mode.

Fixes #65
support/fish-2.2.x
Justin Hileman 8 years ago
parent d744b2fe0f
commit 1f827c6bab

@ -42,7 +42,6 @@ This theme is based loosely on [agnoster][agnoster].
* Background jobs (**`%`**)
* You currently have superpowers (**`$`**)
* Current vi mode
* _You'll need to `set -g theme_display_vi yes` to enable_
* `User@Host` (unless you're the default user)
* Current RVM, rbenv or chruby (Ruby) version
* Current virtualenv (Python) version
@ -77,8 +76,7 @@ set -g theme_display_hg yes
set -g theme_display_virtualenv no
set -g theme_display_ruby no
set -g theme_display_user yes
set -g theme_display_vi yes
set -g theme_display_vi_hide_mode default
set -g theme_display_vi no
set -g theme_display_date no
set -g theme_display_cmd_duration yes
set -g theme_title_display_process yes

@ -0,0 +1,8 @@
# This is handled inside fish_mode_prompt (see `__bobthefish_prompt_vi`)
#
# If you want to override this with your own mode prompt, disable bobthefish's
# built-in mode prompt in your fish config:
#
# set -g theme_display_vi no
function fish_mode_prompt; end

@ -27,8 +27,7 @@
# set -g theme_display_virtualenv no
# set -g theme_display_ruby no
# set -g theme_display_user yes
# set -g theme_display_vi yes
# set -g theme_display_vi_hide_mode default
# set -g theme_display_vi no
# set -g theme_avoid_ambiguous_glyphs yes
# set -g theme_powerline_fonts no
# set -g theme_nerd_fonts yes
@ -520,7 +519,7 @@ function __bobthefish_prompt_dir -S -d 'Display a shortened form of the current
end
function __bobthefish_prompt_vi -S -d 'Display vi mode'
[ "$theme_display_vi" = 'yes' -a "$fish_bind_mode" != "$theme_display_vi_hide_mode" ]; or return
[ "$theme_display_vi" != 'no' -a "$fish_key_bindings" = 'fish_vi_key_bindings' ]; or return
switch $fish_bind_mode
case default
__bobthefish_start_segment $__color_vi_mode_default
@ -528,6 +527,9 @@ function __bobthefish_prompt_vi -S -d 'Display vi mode'
case insert
__bobthefish_start_segment $__color_vi_mode_insert
echo -n 'I '
case replace-one
__bobthefish_start_segment $__color_vi_mode_insert
echo -n 'R '
case visual
__bobthefish_start_segment $__color_vi_mode_visual
echo -n 'V '

Loading…
Cancel
Save