mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2024-11-27 10:49:55 +08:00
Add support for upcoming fish shell native vi mode
This commit is contained in:
parent
07789b763a
commit
2c6cde92b3
|
@ -71,7 +71,8 @@ In a sub-directory of the repository:
|
|||
|
||||
### vi-mode
|
||||
|
||||
This segment display the current `vi-mode` if the plugin is used.
|
||||
This segment display the current `vi-mode` if the fish native vi mode or
|
||||
the oh-my-fish vi-mode plugin is used.
|
||||
See the `[n]` in the previous screenshots.
|
||||
|
||||
### end
|
||||
|
|
|
@ -40,6 +40,21 @@ function __syl20bnr_unpushed_commit_count -d "Return the number of unpushed comm
|
|||
git status -s -b ^/dev/null | grep -E -o "ahead\ [0-9]+" | awk '{print $2}'
|
||||
end
|
||||
|
||||
function fish_vi_prompt_cm --description "Displays the current 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
|
||||
end
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Aliases
|
||||
# ----------------------------------------------------------------------------
|
||||
|
@ -129,11 +144,15 @@ function fish_prompt -d "Write out the left prompt of the syl20bnr theme"
|
|||
end
|
||||
|
||||
# vi mode
|
||||
# If vi_mode plugin is activated then print the vi mode in the prompt.
|
||||
# If vi_mode plugin or native vi mode is activated then print the vi mode
|
||||
# in the prompt.
|
||||
set -l ps_vi ""
|
||||
if test -n "$vi_mode"
|
||||
set ps_vi $colnormal"["$vi_mode$colnormal"]"
|
||||
end
|
||||
if test "$fish_key_bindings" = "fish_vi_key_bindings"
|
||||
set ps_vi (fish_vi_prompt_cm)
|
||||
end
|
||||
|
||||
# end of prompt
|
||||
# The color of the end of the prompt depends on the $status value of the
|
||||
|
|
Loading…
Reference in New Issue
Block a user