From 1f827c6bab0480336d20ed76e4af996acea52b1d Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Tue, 18 Oct 2016 07:04:59 -0700 Subject: [PATCH] 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 --- README.md | 4 +--- fish_mode_prompt.fish | 8 ++++++++ fish_prompt.fish | 8 +++++--- 3 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 fish_mode_prompt.fish diff --git a/README.md b/README.md index f70e2b3..b707438 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/fish_mode_prompt.fish b/fish_mode_prompt.fish new file mode 100644 index 0000000..81e905f --- /dev/null +++ b/fish_mode_prompt.fish @@ -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 diff --git a/fish_prompt.fish b/fish_prompt.fish index 1d31189..bf37015 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -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 '