mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-29 06:13:20 +00:00
sample_prompts/nim: Add vi mode indicator
The default indicator ruined alignment, which is a major design feature here. Handle it by including the mode indicator in the prompt proper. Fixes #6802. [ci skip]
This commit is contained in:
parent
d0bedf3bbd
commit
52f819cd35
1 changed files with 24 additions and 0 deletions
|
@ -75,6 +75,30 @@ function fish_prompt
|
||||||
# Date
|
# Date
|
||||||
_nim_prompt_wrapper $retc '' (date +%X)
|
_nim_prompt_wrapper $retc '' (date +%X)
|
||||||
|
|
||||||
|
# Vi-mode
|
||||||
|
# The default mode prompt would be prefixed, which ruins our alignment.
|
||||||
|
function fish_mode_prompt; end
|
||||||
|
if test "$fish_key_bindings" = fish_vi_key_bindings
|
||||||
|
or test "$fish_key_bindings" = fish_hybrid_key_bindings
|
||||||
|
set -l mode
|
||||||
|
switch $fish_bind_mode
|
||||||
|
case default
|
||||||
|
set mode (set_color --bold red)N
|
||||||
|
case insert
|
||||||
|
set mode (set_color --bold green)I
|
||||||
|
case replace_one
|
||||||
|
set mode (set_color --bold green)R
|
||||||
|
echo '[R]'
|
||||||
|
case replace
|
||||||
|
set mode (set_color --bold cyan)R
|
||||||
|
case visual
|
||||||
|
set mode (set_color --bold magenta)V
|
||||||
|
end
|
||||||
|
set mode $mode(set_color normal)
|
||||||
|
_nim_prompt_wrapper $retc '' $mode
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
# Virtual Environment
|
# Virtual Environment
|
||||||
set -q VIRTUAL_ENV_DISABLE_PROMPT
|
set -q VIRTUAL_ENV_DISABLE_PROMPT
|
||||||
or set -g VIRTUAL_ENV_DISABLE_PROMPT true
|
or set -g VIRTUAL_ENV_DISABLE_PROMPT true
|
||||||
|
|
Loading…
Reference in a new issue