vim in PowerShell and cmd sessions ignore cursor settings #6890

Closed
opened 2026-01-31 00:49:48 +00:00 by claunia · 3 comments
Owner

Originally created by @parml on GitHub (Mar 15, 2020).

Environment

Windows build number: Microsoft Windows [Version 10.0.19041.113]
Windows Terminal version (if applicable): 0.9.433.0

Any other software?
vim for Windows (installed via chocolatey): 8.2.0381

Steps to reproduce

  1. Edit the vim configuration file ($HOME\_vimrc), append the snippet mentioned here: #4335 comment
  2. Open Windows Terminal
  3. Open new CMD or PowerShell session/tab.
  4. start vim -> vim starts in normal mode
  5. Type i to enter insert mode

Expected behavior

After step 4, according to configuration at step1 vim's cursor should be block
After step 5, according to conf at step 1. vim's cursor should be vertical bar.

Actual behavior

vim's cursor is at all times whatever cursor the terminal has.

Notes

Different vim cursors in normal vs insert modes do work partially in PowerShell and CMD windows (not started as sessions in Windows Terminal). Partially because the configuration at step 1 above is ignored indeed, however block for normal and underscore are the different cursors in the two modes.

This bug report only addresses only vim in PowerShell and CMD sessions in Windows Terminal.
Please refer to #4335 for a solution for vim in WSL sessions) works in both WSL1 and WSL2. There are two problems there as described in #4335 comment2

Thank you for building the soundest terminal on windows.

Originally created by @parml on GitHub (Mar 15, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: Microsoft Windows [Version 10.0.19041.113] Windows Terminal version (if applicable): 0.9.433.0 Any other software? vim for Windows (installed via chocolatey): 8.2.0381 ``` # Steps to reproduce <!-- A description of how to trigger this bug. --> 1. Edit the vim configuration file ($HOME\\_vimrc), append the snippet mentioned here: [#4335 comment](https://github.com/microsoft/terminal/issues/4335#issuecomment-577365966) 2. Open Windows Terminal 3. Open new CMD or PowerShell session/tab. 4. start vim -> vim starts in normal mode 5. Type i to enter insert mode # Expected behavior After step 4, according to configuration at step1 vim's cursor should be block After step 5, according to conf at step 1. vim's cursor should be vertical bar. # Actual behavior vim's cursor is at all times whatever cursor the terminal has. # Notes Different vim cursors in normal vs insert modes do work partially in PowerShell and CMD windows (not started as sessions in Windows Terminal). Partially because the configuration at step 1 above is ignored indeed, however block for normal and underscore are the different cursors in the two modes. This bug report only addresses only vim in PowerShell and CMD sessions in Windows Terminal. Please refer to [#4335](https://github.com/microsoft/terminal/issues/4335) for a solution for vim in WSL sessions) works in both WSL1 and WSL2. There are two problems there as described in [#4335 comment2](https://github.com/microsoft/terminal/issues/4335#issuecomment-599246201) Thank you for building the soundest terminal on windows.
claunia added the Needs-TriageNeeds-Tag-Fix labels 2026-01-31 00:49:48 +00:00
Author
Owner

@jdebp commented on GitHub (Mar 16, 2020):

As I wrote in #4734, Windows Terminal already does what is needed here, pace the flushing problem. One can demonstrate it with CursorShape.ps1, indeed.

Therefore look to vim for the locus of this problem.

@jdebp commented on GitHub (Mar 16, 2020): As I wrote in #4734, Windows Terminal already does what is needed here, pace the flushing problem. One can demonstrate it with [CursorShape.ps1](https://github.com/jdebp/terminal-tests/blob/master/PowerShell/CursorShape.ps1), indeed. Therefore look to vim for the locus of this problem.
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 16, 2020):

Indeed. Thanks jdepb 😄

@DHowett-MSFT commented on GitHub (Mar 16, 2020): Indeed. Thanks jdepb :smile:
Author
Owner

@parml commented on GitHub (Mar 17, 2020):

@jdebp, thank you for the info.

neovim acts correctly when started (nvim). vim is the culprit in the OP and needs to be taught to act rightly, indeed.

One problem left. When neovim is exited, the Terminal is left with neovim's last cursor before exit (block) instead of underscore that the terminal profile has configured:

"name": "Windows PowerShell",
"cursorShape": "underscore"

and that incorrect cursor is not blinking. This will persist until session killed.

That problem has been reported here too.

Please let me know if neovim exits incorrectly so that I can address that with its team. Thanks.

@parml commented on GitHub (Mar 17, 2020): @jdebp, thank you for the info. neovim acts correctly when started (`nvim`). vim is the culprit in the OP and needs to be taught to act rightly, indeed. One problem left. When neovim is exited, the Terminal is left with neovim's last cursor before exit (block) instead of underscore that the terminal profile has configured: ``` "name": "Windows PowerShell", "cursorShape": "underscore" ``` and that incorrect cursor is not blinking. This will persist until session killed. That problem has been reported [here](https://github.com/microsoft/terminal/issues/4335#issuecomment-591338416) too. Please let me know if neovim exits incorrectly so that I can address that with its team. Thanks.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#6890