To recreate from a fresh installation:
fish_vi_key_bindings
fish_config prompt save nim
fish
The glitch:
$ fish
Welcome to fish, the friendly interactive shell
[I] ┬─[user@hostname:~]─[00:00:01 AM]─[I]
Notice how there are two instances of the insert mode indicator. This only happens on the very first prompt; subsequent renders only shows it once on the right.
This is due to fish_mode_prompt being set to empty too late during boot. It's set in nim.fish inside fish_prompt, but that runs after fish_mode_prompt:
|
# Vi-mode |
|
# The default mode prompt would be prefixed, which ruins our alignment. |
|
function fish_mode_prompt |
|
end |
Workaround for the glitch: funcsave fish_mode_prompt. This avoids running the default fish_mode_prompt` on boot.
Fix suggestion
A possible fix is to run funcsave fish_mode_prompt in fish_config prompt save.
This patch is untested. I don't know whether this will play nice with the web interface fish_config and don't know if it has some adverse interactions in some scenarios.
diff --git a/share/functions/fish_config.fish b/share/functions/fish_config.fish
index ffd19033d..a7f897bf0 100644
--- a/share/functions/fish_config.fish
+++ b/share/functions/fish_config.fish
@@ -158,6 +158,8 @@ function fish_config --description "Launch fish's web based configuration"
and cp $__fish_config_dir/functions/fish_prompt.fish{,.bak}
path is $__fish_config_dir/functions/fish_right_prompt.fish
and cp $__fish_config_dir/functions/fish_right_prompt.fish{,.bak}
+ path is $__fish_config_dir/functions/fish_mode_prompt.fish
+ and cp $__fish_config_dir/functions/fish_mode_prompt.fish{,.bak}
set -l have
if set -q argv[1]
@@ -170,6 +172,8 @@ function fish_config --description "Launch fish's web based configuration"
end
function fish_right_prompt
end
+ function fish_mode_prompt
+ end
source $f
or return 2
end
@@ -188,6 +192,7 @@ function fish_config --description "Launch fish's web based configuration"
or return
funcsave fish_right_prompt 2>/dev/null
+ funcsave fish_mode_prompt 2>/dev/null
return
else
echo Not overwriting
$ fish --version
fish, version 4.1.2
To recreate from a fresh installation:
The glitch:
Notice how there are two instances of the insert mode indicator. This only happens on the very first prompt; subsequent renders only shows it once on the right.
This is due to
fish_mode_promptbeing set to empty too late during boot. It's set in nim.fish insidefish_prompt, but that runs afterfish_mode_prompt:fish-shell/share/tools/web_config/sample_prompts/nim.fish
Lines 81 to 84 in 5f0d83d
Workaround for the glitch:
funcsave fish_mode_prompt. This avoids running the default fish_mode_prompt` on boot.Fix suggestion
A possible fix is to run
funcsave fish_mode_promptinfish_config prompt save.This patch is untested. I don't know whether this will play nice with the web interface
fish_configand don't know if it has some adverse interactions in some scenarios.