diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2015-06-04 13:31:48 -0700 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2015-06-14 11:36:11 -0700 |
commit | 767742c7e7ee53c8aa7950f928d551c63d69448f (patch) | |
tree | 600a9090d1c5dd699170bf2b348e551c2f2f6287 /share/functions/fish_mode_prompt.fish | |
parent | 0ddd0ed4fbee08429c215946ca4dd19cd3e56a63 (diff) |
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.
Diffstat (limited to 'share/functions/fish_mode_prompt.fish')
-rw-r--r-- | share/functions/fish_mode_prompt.fish | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/share/functions/fish_mode_prompt.fish b/share/functions/fish_mode_prompt.fish new file mode 100644 index 00000000..30521679 --- /dev/null +++ b/share/functions/fish_mode_prompt.fish @@ -0,0 +1,19 @@ +# 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 |