#13331·ohmyzsh

Bug in vi-mode in linux under WSL

Author: JustThat70Created Sep 26, 2025Updated Sep 11, 2026
LabelsBug

Describe the bug

When using the vi-mode plugin on Fedora 40 under WSL on Windows 11 in Windows Terminal, using "xp" to swap two characters adds a ^M character to the paste. "dlp" does this as well

If I ssh into localhost from my linux terminal (or from powershell etc...) and repeat the steps above xp works as expected without the extra ^M

Steps to reproduce

  1. Create a clean profile by backing up .zshrc and copying .zshrc.omz_default to .zshrc
  2. Launch a new shell
  3. Ensure the vi-mode plugin is disabled: omz plugin disable vi-mode
  4. Set vi mode: set -o vi
  5. Type omz plugin enable vi-mode
  6. Move the cursor to the m and press <esc>
  7. Type xp and the - and m will switch places
  8. Reverse the change by pressing u twice and hit <enter> to enable the vi-mode plugin
  9. Hit <up> and move the cursor to the m and press <esc>
  10. Type xp and see the bad result: omz plugin enable vim-^Mode

Expected behavior

vi-mode paste should not append a \r or ^M

Screenshots and recordings

https://github.com/user-attachments/assets/a30dc3fd-cb85-4872-9f20-fde84972dbff

OS / Linux distribution

Fedora 40 running under WSL on Windows 11

Zsh version

5.9

Oh My Zsh version

master (ddd7751)

Terminal emulator

Windows Terminal

If using WSL on Windows, which version of WSL

WSL2

Additional context

No response