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
- Create a clean profile by backing up .zshrc and copying .zshrc.omz_default to .zshrc
- Launch a new shell
- Ensure the vi-mode plugin is disabled:
omz plugin disable vi-mode - Set vi mode:
set -o vi - Type
omz plugin enable vi-mode - Move the cursor to the m and press
<esc> - Type
xpand the - and m will switch places - Reverse the change by pressing
utwice and hit<enter>to enable the vi-mode plugin - Hit
<up>and move the cursor to the m and press<esc> - Type
xpand 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
Source: ohmyzsh/ohmyzsh