Fish bind mode not working as expected after update #5393
-
I configured posh to display colors and text specific to the fish bind mode. In the past, the changes have been immediate when entering a new mode (e.g., hitting Current terminal, shell, and prompt versions:
# omp.toml
"$schema" = "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json"
version = 2
final_space = false
# Catppuccin Palette
[palette]
rosewater = "#f5e0dc"
flamingo = "#f2cdcd"
pink = "#f5c2e7"
mauve = "#cba6f7"
red = "#f38ba8"
maroon = "#eba0ac"
peach = "#fab387"
yellow = "#f9e2af"
green = "#a6e3a1"
teal = "#94e2d5"
sky = "#89dceb"
sapphire = "#74c7ec"
blue = "#89b4fa"
lavender = "#b4befe"
text = "#cdd6f4"
subtext1 = "#bac2de"
subtext0 = "#a6adc8"
overlay2 = "#9399b2"
overlay1 = "#7f849c"
overlay0 = "#6c7086"
surface2 = "#585b70"
surface1 = "#45475a"
surface0 = "#313244"
base = "#1e1e2e"
mantle = "#181825"
crust = "#11111b"
#
# Left Block
#
[[blocks]]
type = "prompt"
alignment = "left"
newline = true
# Mode
[[blocks.segments]]
type = "text"
style = "plain"
foreground = "p:base"
template = """\
<b>\
{{ if eq \"default\" .Env.OMP_BIND_MODE }}<,p:blue> NORMAL </>{{ end }}\
{{ if eq \"insert\" .Env.OMP_BIND_MODE }}<,p:green> INSERT </>{{ end }}\
{{ if eq \"replace\" .Env.OMP_BIND_MODE }}<,p:red> REPLACE </>{{ end }}\
{{ if eq \"replace_one\" .Env.OMP_BIND_MODE }}<,p:blue> NORMAL </>{{ end }}\
{{ if eq \"visual\" .Env.OMP_BIND_MODE }}<,p:mauve> VISUAL </>{{ end }}\
</b>"""
# Git
[[blocks.segments]]
type = "text"
style = "plain"
foreground_templates = [
"{{ if eq \"default\" .Env.OMP_BIND_MODE }}p:blue{{ end }}",
"{{ if eq \"insert\" .Env.OMP_BIND_MODE }}p:green{{ end }}",
"{{ if eq \"replace\" .Env.OMP_BIND_MODE }}p:red{{ end }}",
"{{ if eq \"replace_one\" .Env.OMP_BIND_MODE }}p:blue{{ end }}",
"{{ if eq \"visual\" .Env.OMP_BIND_MODE }}p:mauve{{ end }}",
]
background = "p:surface0"
template = " {{ .Env.OMP_GIT_BRANCH }} "
# Session
[[blocks.segments]]
type = "session"
style = "plain"
foreground = "p:text"
template = " {{ if .SSHSession }}{{ .UserName }}@{{ .HostName }}{{ end }}"
# Path
[[blocks.segments]]
type = "path"
style = "plain"
foreground = "p:text"
background = "p:mantle"
template = " {{ .Path }} "
[blocks.segments.properties]
style = "full"
#
# Right Block
#
[[blocks]]
type = "prompt"
alignment = "right"
filler = "<,p:mantle> </>"
# Shell
[[blocks.segments]]
type = "text"
style = "plain"
foreground = "p:text"
background = "p:mantle"
template = " {{ .Shell }} "
# Execution Time
[[blocks.segments]]
type = "executiontime"
style = "plain"
foreground = "p:base"
background_templates = [
"{{ if eq \"default\" .Env.OMP_BIND_MODE }}p:blue{{ end }}",
"{{ if eq \"insert\" .Env.OMP_BIND_MODE }}p:green{{ end }}",
"{{ if eq \"replace\" .Env.OMP_BIND_MODE }}p:red{{ end }}",
"{{ if eq \"replace_one\" .Env.OMP_BIND_MODE }}p:blue{{ end }}",
"{{ if eq \"visual\" .Env.OMP_BIND_MODE }}p:mauve{{ end }}",
]
template = " <b>{{ .FormattedMs }}</b> "
[blocks.segments.properties]
style = "round"
always_enabled = true
#
# Prompt
#
[[blocks]]
type = "prompt"
alignment = "left"
newline = true
[[blocks.segments]]
type = "status"
style = "plain"
foreground = "p:text"
foreground_templates = ["{{ if gt .Code 0 }}p:red{{ end }}"]
template = ": "
[blocks.segments.properties]
always_enabled = true
[transient_prompt]
foreground = "p:text"
template = ": " # fish/conf.d/omp.fish
oh-my-posh init fish --config ~/.config/omp.toml | source
function set_poshcontext --no-scope-shadowing
set -e OMP_BIND_MODE
set -e OMP_GIT_BRANCH
set -gx OMP_BIND_MODE $fish_bind_mode
if git branch --show-current 2>/dev/null | read -l git_branch
set -gx OMP_GIT_BRANCH $git_branch
end
end |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 15 replies
-
@cpplain we changed the way the prompt is re-rendered to only do so when an actual change occurs. So highly likely this has something to do with it, but that's by design to be more efficient. That's why |
Beta Was this translation helpful? Give feedback.
-
@cpplain For your use case, here is a simple workaround: function repaint_on_bind_mode_change --on-variable fish_bind_mode
if test $fish_bind_mode != paste
set _omp_new_prompt true
commandline --function repaint
end
end Despite this, I do NOT recommend doing so because:
|
Beta Was this translation helpful? Give feedback.
-
Accurately displaying fish bind mode as it changes is a must for me. I do appreciate you need to make changes to the project that will help the majority of users (i.e., when to re-render). Unfortunately for me, this means I will not be able to continue using oh-my-posh. I am disappointed as I found oh-my-posh to be a far better alternative than the other prompts I've tried. I wish the project continued success in the future. UPDATE 2024-08-01 17:51 UTC |
Beta Was this translation helpful? Give feedback.
@JanDeDobbeleer @lewis-yeung I updated my config to match docs after the
23.6
release. Everything is working as I expect. Thank you again for addressing this so quickly.doc ref: https://ohmyposh.dev/docs/faq#fish-display-current-bind-vim-mode