From af1e19724c36c0bbffa3f1d83624ee965da1d14a Mon Sep 17 00:00:00 2001 From: Oliver Schrenk Date: Thu, 29 Oct 2015 15:25:04 +0100 Subject: [PATCH] Support vi mode --- fish_prompt.fish | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/fish_prompt.fish b/fish_prompt.fish index deddc6b..a0e69dc 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -19,6 +19,9 @@ # set -g theme_display_virtualenv no # set -g theme_display_ruby no # set -g theme_display_user yes +# set -g theme_display_vi no +# set -g theme_title_display_process yes +# set -g theme_title_display_path no # set -g theme_date_format "+%a %H:%M" # set -g theme_avoid_ambiguous_glyphs yes # set -g default_user your_normal_user @@ -365,6 +368,23 @@ function __bobthefish_prompt_dir -d 'Display a shortened form of the current dir __bobthefish_path_segment "$PWD" end +function __bobthefish_prompt_vi -d 'Display vi mode' + [ "$theme_display_vi" = 'no' ]; and return + set -l vi_mode + switch $fish_bind_mode + case default + __bobthefish_start_segment $__bobthefish_med_grey $__bobthefish_dk_grey --bold + echo -n -s 'N' + case insert + __bobthefish_start_segment $__bobthefish_lt_green $__bobthefish_dk_grey --bold + echo -n -s 'I' + case visual + __bobthefish_start_segment $__bobthefish_lt_orange $__bobthefish_dk_grey --bold + echo -n -s 'V' + end + set_color normal +end + function __bobthefish_virtualenv_python_version -d 'Get current python version' set -l python_version (readlink (which python)) switch "$python_version" @@ -470,5 +490,6 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome' else __bobthefish_prompt_dir end + __bobthefish_prompt_vi __bobthefish_finish_segments end