Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zsh-vi-mode incompability #5992

Open
1 task done
kritag opened this issue Dec 10, 2024 · 1 comment
Open
1 task done

Zsh-vi-mode incompability #5992

kritag opened this issue Dec 10, 2024 · 1 comment
Assignees
Labels
🐛 bug Something isn't working

Comments

@kritag
Copy link

kritag commented Dec 10, 2024

Code of Conduct

  • I agree to follow this project's Code of Conduct

What happened?

With the ZVM plugin enabled, I have this simple .zshrc that I experience this bug with:

#!/usr/bin/zsh
PATH="${PATH}:$HOME/bin:$HOME/.local/bin:$HOME/.krew/bin:$HOME/.npm-global/bin:$HOME/.nix-profile/bin"
export PATH
source ~/git/znap/znap/znap.zsh # Start Znap
eval "$(oh-my-posh init zsh --config $HOME/.config/oh-my-posh/omp.yaml)"
znap source jeffreytse/zsh-vi-mode

This puts me initially in vi-mode thanks to the plugin. If I enter a command, run it, then hit Ctrl + C, I am no longer in vi-mode, but what appears to be emacs mode.

This behavior does not happen if I enable evrything else I have, but have oh-my-posh disabled, therefore I have concluded that most likely it's something with oh-my-posh or zsh-vi-mode.

I have attached the output of declare before and after the issue happens.
declarediff.txt

I have deleted ~/.cache/zsh* and ~/.cache/oh-my-posh.

Closing my terminal (kitty) puts me where I want it to work, so does exec zsh, but I cannot be doing that after each time I Ctrl+C.

bindkey -v in the terminal and in .zshrc works as expected when zsh-vi-mode is disabled.

Theme

Tested with default aka. no config.

What OS are you seeing the problem on?

Linux

Which shell are you using?

zsh

Log output

Version: 24.12.0

Shell: zsh (5.9)

Prompt:

 <username>   �]8;;file:�\~�]8;;\    

Segments:

ConsoleTitle(true)                        -   0 ms
Session(true)                             -   0 ms
Path(true)                                -   0 ms
Git(false)                                -   0 ms
Root(false)                               -   0 ms
Status(true)                              -   0 ms
Node(false)                               -   0 ms
Go(false)                                 -   0 ms
Python(false)                             -   0 ms
Shell(true)                               -   0 ms
Time(true)                                -   0 ms

Run duration: 2.399786ms

Cache path: /home/<username>/.cache/oh-my-posh

Config path: no --config set, using default built-in configuration

Logs:

�[38;2;191;207;240m[DEBUG] �[38;2;156;231;201m15:20:57.201 �[0mcommand.go:execute:989�[38;2;156;231;201m →�[0m debug mode enabled
�[38;2;204;137;214m[TRACE] �[38;2;156;231;201m15:20:57.201 �[0mdebug.go() - �[38;2;156;231;201m343ns�[0m
�[38;2;191;207;240m[DEBUG] �[38;2;156;231;201m15:20:57.201 �[0mload.go:Load:29�[38;2;156;231;201m →�[0m no config file specified, using default
�[38;2;204;137;214m[TRACE] �[38;2;156;231;201m15:20:57.201 �[0mload.go:Load() - �[38;2;156;231;201m7.77µs�[0m
�[38;2;204;137;214m[TRACE] �[38;2;156;231;201m15:20:57.201 �[0mdebug.go() - �[38;2;156;231;201m10.051µs�[0m
[DEBUG] 15:20:57.201 debug.go:52 → plain mode enabled
[TRACE] 15:20:57.201 terminal.go() - 5.443µs
[DEBUG] 15:20:57.201 terminal.go:59 → loading cache file: /home/<username>/.cache/oh-my-posh/omp.cache
[DEBUG] 15:20:57.201 terminal.go:59 → loading cache key: environment_platform
[DEBUG] 15:20:57.201 terminal.go:59 → loading cache key: is_wsl
[TRACE] 15:20:57.201 terminal.go(/home/<username>/.cache/oh-my-posh/omp.cache) - 42.59µs
[TRACE] 15:20:57.201 terminal.go() - 3.427µs
[DEBUG] 15:20:57.201 terminal.go:59 → loading cache file: /home/<username>/.cache/oh-my-posh/omp.cache.3543c461-215e-43a9-b0fb-8691b3153f89
[DEBUG] 15:20:57.201 terminal.go:59 → loading cache key: prompt_count_cache
[DEBUG] 15:20:57.201 terminal.go:59 → loading cache key: template_cache
[TRACE] 15:20:57.201 terminal.go(/home/<username>/.cache/oh-my-posh/omp.cache.3543c461-215e-43a9-b0fb-8691b3153f89) - 24.212µs
[TRACE] 15:20:57.201 terminal.go:Init() - 378ns
[TRACE] 15:20:57.201 terminal.go() - 32ns
[DEBUG] 15:20:57.201 terminal.go:Init:67 → /home/<username>
[TRACE] 15:20:57.201 terminal.go:Init() - 5.954µs
[TRACE] 15:20:57.201 debug.go() - 103.281µs
[TRACE] 15:20:57.201 init.go:Init() - 45ns
[TRACE] 15:20:57.201 cache.go:loadCache() - 30ns
[TRACE] 15:20:57.201 cache.go:loadCache() - 50.205µs
[DEBUG] 15:20:57.201 debug.go:61 → terminal program: Unknown
[DEBUG] 15:20:57.201 debug.go:61 → terminal shell: shell
[DEBUG] 15:20:57.201 config.go:MakeColors:58 → NO DATA
[TRACE] 15:20:57.201 config.go:MakeColors(OMP_CACHE_DISABLED) - 2.169µs
[TRACE] 15:20:57.201 colors.go:MakeColors() - 302ns
[TRACE] 15:20:57.201 debug.go:PrintDebug() - 34ns
[DEBUG] 15:20:57.201 debug.go:PrintDebug:16 → 5.9
[TRACE] 15:20:57.201 debug.go:PrintDebug(POSH_SHELL_VERSION) - 2.793µs
[DEBUG] 15:20:57.201 debug.go:72 → segment: Title
[TRACE] 15:20:57.201 engine.go:getTitleTemplateText({{ .Shell }} in {{ .Folder }}) - 109.255µs
[TRACE] 15:20:57.201 primary.go:needsPrimaryRightPrompt() - 18ns
[DEBUG] 15:20:57.201 terminal.go:CursorPosition:583 → NO DATA
[TRACE] 15:20:57.201 terminal.go:CursorPosition(POSH_CURSOR_LINE) - 2.051µs
[DEBUG] 15:20:57.201 terminal.go:CursorPosition:587 → NO DATA
[TRACE] 15:20:57.201 terminal.go:CursorPosition(POSH_CURSOR_COLUMN) - 1.435µs
[TRACE] 15:20:57.201 primary.go:writePrimaryPrompt() - 32ns
[TRACE] 15:20:57.201 primary.go:writePrimaryPrompt() - 17ns
[TRACE] 15:20:57.201 segment.go:Execute() - 25ns
[DEBUG] 15:20:57.201 home.go:Home:16 → /home/<username>
[TRACE] 15:20:57.201 terminal.go:DirMatchesOneOf() - 36ns
[DEBUG] 15:20:57.201 segment.go:Execute:109 → segment: Status
[DEBUG] 15:20:57.201 segment.go:Execute:111 → no toggles found
[TRACE] 15:20:57.201 status.go:Enabled() - 40ns
[DEBUG] 15:20:57.202 status.go:formatStatus:45 → {{ .Code }}
[TRACE] 15:20:57.202 status.go:formatStatus({{ .Code }}) - 20.702µs
[DEBUG] 15:20:57.202 status.go:Enabled:37 → always_enabled: true
[TRACE] 15:20:57.202 segment.go:Execute() - 18ns
[DEBUG] 15:20:57.202 home.go:Home:16 → /home/<username>
[TRACE] 15:20:57.202 terminal.go:DirMatchesOneOf() - 18ns
[DEBUG] 15:20:57.202 segment.go:Execute:109 → segment: Root
[DEBUG] 15:20:57.202 segment.go:Execute:111 → no toggles found
[TRACE] 15:20:57.202 root.go:Enabled() - 571ns
[TRACE] 15:20:57.202 segment.go:Execute() - 26ns
[DEBUG] 15:20:57.202 home.go:Home:16 → /home/<username>
[TRACE] 15:20:57.202 terminal.go:DirMatchesOneOf() - 17ns
[DEBUG] 15:20:57.202 segment.go:Execute:109 → segment: Path
[DEBUG] 15:20:57.202 segment.go:Execute:111 → no toggles found
[DEBUG] 15:20:57.202 path.go:147 → display_cygpath: false
[TRACE] 15:20:57.202 path.go:setPaths() - 34ns
[TRACE] 15:20:57.202 path.go:setPaths() - 33ns
[TRACE] 15:20:57.202 path.go:setPaths() - 41ns
[TRACE] 15:20:57.202 path.go:setPaths() - 20ns
[TRACE] 15:20:57.202 path.go:parsePath() - 31ns
[DEBUG] 15:20:57.202 path.go:setMappedLocations:557 → mapped_locations_enabled: true
[DEBUG] 15:20:57.202 path.go:setMappedLocations:558 → 
[DEBUG] 15:20:57.202 path.go:setMappedLocations:559 → 
[DEBUG] 15:20:57.202 home.go:Home:16 → /home/<username>
[TRACE] 15:20:57.202 clean.go:Clean() - 25ns
[TRACE] 15:20:57.202 path.go:normalize() - 17ns
[TRACE] 15:20:57.202 path.go:normalize() - 32ns
[DEBUG] 15:20:57.202 path.go:setMappedLocations:560 → ~
[DEBUG] 15:20:57.202 path.go:setMappedLocations:565 → mapped_locations: map[]
[TRACE] 15:20:57.202 clean.go:Clean() - 33ns
[TRACE] 15:20:57.202 path.go:normalize() - 18ns
[TRACE] 15:20:57.202 path.go:normalize() - 17ns
[TRACE] 15:20:57.202 clean.go:Clean() - 18ns
[TRACE] 15:20:57.202 path.go:normalize() - 16ns
[TRACE] 15:20:57.202 path.go:normalize() - 17ns
[TRACE] 15:20:57.202 path.go:parsePath() - 17ns
[TRACE] 15:20:57.202 path.go:parsePath() - 18ns
[TRACE] 15:20:57.202 path.go:parsePath() - 17ns
[TRACE] 15:20:57.202 path.go:setStyle() - 35ns
[TRACE] 15:20:57.202 segment.go:Execute() - 208ns
[DEBUG] 15:20:57.202 path.go:colorizePath:734 → cycle: []
[DEBUG] 15:20:57.202 path.go:getFolderSeparator:267 → NO DATA
[DEBUG] 15:20:57.202 path.go:getFolderSeparator:269 → /
[DEBUG] 15:20:57.202 path.go:colorizePath:737 → cycle_folder_separator: false
[DEBUG] 15:20:57.202 path.go:colorizePath:738 → %s
[DEBUG] 15:20:57.202 home.go:Home:16 → /home/<username>
[DEBUG] 15:20:57.202 path.go:colorizePath:740 → %s
[TRACE] 15:20:57.202 terminal.go:DirMatchesOneOf() - 73ns
[DEBUG] 15:20:57.202 path.go:colorizePath:741 → %s
[DEBUG] 15:20:57.202 path.go:colorizePath:742 → %s
[DEBUG] 15:20:57.202 segment.go:Execute:109 → segment: Session
[DEBUG] 15:20:57.202 segment.go:Execute:111 → no toggles found
[TRACE] 15:20:57.202 path.go:Enabled() - 17ns
[DEBUG] 15:20:57.202 session.go:activeSSHSession:31 → NO DATA
[TRACE] 15:20:57.202 path.go:Enabled() - 32ns
[TRACE] 15:20:57.202 session.go:activeSSHSession(SSH_CONNECTION) - 3.296µs
[TRACE] 15:20:57.202 path.go:Enabled() - 50ns
[DEBUG] 15:20:57.202 session.go:activeSSHSession:31 → NO DATA
[TRACE] 15:20:57.202 session.go:activeSSHSession(SSH_CLIENT) - 1.701µs
[DEBUG] 15:20:57.202 session.go:activeSSHSession:37 → arch
[TRACE] 15:20:57.202 path.go:Enabled(/home/<username>) - 2.466µs
[TRACE] 15:20:57.202 segment.go:Execute() - 166ns
[DEBUG] 15:20:57.202 home.go:Home:16 → /home/<username>
[TRACE] 15:20:57.202 terminal.go:DirMatchesOneOf() - 53ns
[DEBUG] 15:20:57.202 segment.go:Execute:109 → segment: Git
[DEBUG] 15:20:57.202 segment.go:Execute:111 → no toggles found
[DEBUG] 15:20:57.202 terminal_unix.go:IsWsl2:49 → false
[TRACE] 15:20:57.202 terminal_unix.go:IsWsl2() - 2.807µs
[TRACE] 15:20:57.202 terminal_unix.go:InWSLSharedDrive() - 4.706µs
[TRACE] 15:20:57.202 scm.go:hasCommand() - 38ns
[DEBUG] 15:20:57.202 terminal.go:HasCommand:323 → /usr/bin/git
[TRACE] 15:20:57.202 terminal.go:HasCommand(git) - 29.181µs
[TRACE] 15:20:57.202 scm.go:hasCommand(git) - 31.158µs
[DEBUG] 15:20:57.202 git.go:shouldDisplay:328 → fetch_bare_info: false
[DEBUG] 15:20:57.202 terminal.go:HasParentFilePath:446 → /home/<username>
[TRACE] 15:20:57.202 terminal.go:HasParentFilePath(/home/<username>) - 5.6µs
[ERROR] 15:20:57.202 git.go:shouldDisplay:338 → stat .git: no such file or directory
[TRACE] 15:20:57.202 git.go:shouldDisplay(.git) - 19.799µs
[DEBUG] 15:20:57.202 session.go:activeSSHSession:41 → NO DATA
[TRACE] 15:20:57.202 session.go:activeSSHSession(who am i) - 510.551µs
[TRACE] 15:20:57.203 segment.go:string( {{ if .SSHSession }} {{ end }}{{ .UserName }} ) - 764.072µs
[TRACE] 15:20:57.203 segment.go:resolve(diamond) - 121ns
[TRACE] 15:20:57.203 segment.go:string(  {{ path .Path .Location }} ) - 25.263µs
[TRACE] 15:20:57.203 segment.go:resolve(powerline) - 71ns
[TRACE] 15:20:57.203 segment.go:resolve(powerline) - 69ns
[TRACE] 15:20:57.203 segment.go:resolve(powerline) - 27ns
[TRACE] 15:20:57.203 segment.go:string( {{ if gt .Code 0 }}{{ else }}{{ end }} ) - 15.19µs
[TRACE] 15:20:57.203 list.go:FirstMatch({{ if gt .Code 0 }}p:red{{ end }}) - 10.528µs
[TRACE] 15:20:57.203 segment.go:resolve(diamond) - 44ns
[TRACE] 15:20:57.203 list.go:FirstMatch({{ if gt .Code 0 }}p:red{{ end }}) - 7.523µs
[TRACE] 15:20:57.203 engine.go:applyPowerShellBleedPatch() - 71ns
[TRACE] 15:20:57.203 engine.go:applyPowerShellBleedPatch() - 22ns
[TRACE] 15:20:57.203 segment.go:Execute() - 39ns
[DEBUG] 15:20:57.203 home.go:Home:16 → /home/<username>
[TRACE] 15:20:57.203 segment.go:Execute() - 149ns
[TRACE] 15:20:57.203 terminal.go:DirMatchesOneOf() - 57ns
[DEBUG] 15:20:57.203 segment.go:Execute:109 → segment: Time
[DEBUG] 15:20:57.203 home.go:Home:16 → /home/<username>
[DEBUG] 15:20:57.203 segment.go:Execute:111 → no toggles found
[TRACE] 15:20:57.203 terminal.go:DirMatchesOneOf() - 52ns
[DEBUG] 15:20:57.203 segment.go:Execute:109 → segment: Go
[TRACE] 15:20:57.203 segment.go:Execute() - 93ns
[DEBUG] 15:20:57.203 time.go:Enabled:27 → 15:04:05
[TRACE] 15:20:57.203 segment.go:Execute() - 126ns
[DEBUG] 15:20:57.203 segment.go:Execute() - 29ns
[TRACE] 15:20:57.203 terminal.go:DirMatchesOneOf() - 42ns
[DEBUG] 15:20:57.203 home.go:Home:16 → /home/<username>
[DEBUG] 15:20:57.203 language.go:Enabled:118 → extensions: [*.go go.mod]
[DEBUG] 15:20:57.203 segment.go:Execute:109 → segment: Python
[TRACE] 15:20:57.203 terminal.go:DirMatchesOneOf() - 33ns
[DEBUG] 15:20:57.203 language.go:Enabled:119 → folders: []
[DEBUG] 15:20:57.203 segment.go:Execute:111 → no toggles found
[DEBUG] 15:20:57.203 language.go:Enabled:126 → home_enabled: false
[DEBUG] 15:20:57.203 segment.go:Execute:109 → segment: Shell
[DEBUG] 15:20:57.203 home.go:Home:16 → /home/<username>
[DEBUG] 15:20:57.203 home.go:Home:16 → /home/<username>
[DEBUG] 15:20:57.203 segment.go:Execute:111 → no toggles found
[TRACE] 15:20:57.203 terminal.go:DirMatchesOneOf() - 32ns
[DEBUG] 15:20:57.203 python.go:Enabled:56 → files
[DEBUG] 15:20:57.203 segment.go:Execute:109 → segment: Node
[DEBUG] 15:20:57.203 shell.go:Enabled:26 → mapped_shell_names: map[]
[TRACE] 15:20:57.203 shell.go:Enabled() - 57ns
[DEBUG] 15:20:57.203 segment.go:Execute:111 → no toggles found
[TRACE] 15:20:57.203 shell.go:Enabled() - 30ns
[DEBUG] 15:20:57.203 language.go:Enabled:118 → extensions: [*.py *.ipynb pyproject.toml venv.bak]
[DEBUG] 15:20:57.203 language.go:Enabled:119 → folders: [.venv venv virtualenv venv-win pyenv-win]
[DEBUG] 15:20:57.203 language.go:Enabled:126 → home_enabled: false
[DEBUG] 15:20:57.203 home.go:Home:16 → /home/<username>
[DEBUG] 15:20:57.203 language.go:Enabled:118 → extensions: [*.js *.ts package.json .nvmrc pnpm-workspace.yaml .pnpmfile.cjs .vue]
[DEBUG] 15:20:57.203 language.go:Enabled:119 → folders: []
[DEBUG] 15:20:57.203 language.go:Enabled:126 → home_enabled: false
[DEBUG] 15:20:57.203 home.go:Home:16 → /home/<username>
[TRACE] 15:20:57.203 segment.go:resolve(plain) - 226ns
[TRACE] 15:20:57.203 segment.go:resolve(plain) - 63ns
[TRACE] 15:20:57.203 segment.go:resolve(plain) - 27ns
[TRACE] 15:20:57.203 segment.go:string(in <p:blue><b>{{ .Name }}</b></> ) - 103.015µs
[TRACE] 15:20:57.203 segment.go:resolve(plain) - 60ns
[TRACE] 15:20:57.203 segment.go:string(at <p:blue><b>{{ .CurrentDate | date "15:04:05" }}</b></>) - 22.008µs
[TRACE] 15:20:57.203 segment.go:resolve(plain) - 43ns
[TRACE] 15:20:57.203 engine.go:applyPowerShellBleedPatch() - 78ns
[TRACE] 15:20:57.203 engine.go:applyPowerShellBleedPatch() - 18ns
[TRACE] 15:20:57.203 primary.go:writePrimaryPrompt() - 39ns
[TRACE] 15:20:57.203 primary.go:Primary() - 19ns
[TRACE] 15:20:57.203 primary.go:Primary() - 18ns
[TRACE] 15:20:57.203 debug.go:PrintDebug() - 7.038µs
[TRACE] 15:20:57.203 debug.go:PrintDebug() - 18ns
@kritag kritag added the 🐛 bug Something isn't working label Dec 10, 2024
@rseichter
Copy link

I wonder if this has anything to do with znap (which I don't use myself)? Personally, I only add the ZVM plugin to the aptly named array and then let Oh My Zsh do its thing:

plugins=(... zsh-vi-mode)
source "$HOME"/.oh-my-zsh/oh-my-zsh.sh

Works for me, and I have not experienced the problem of dropping out of Vi mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants