cursor can't restore its shape after leaving Vim and WSL #17846

Closed
opened 2026-01-31 05:56:08 +00:00 by claunia · 7 comments
Owner

Originally created by @thezbm on GitHub (Jul 2, 2022).

Windows Terminal version

1.13.11432.0

Windows build number

10.0.22000.0

Other Software

Ubuntu 22.04 LTS
Neovim v0.7.0

Steps to reproduce

The cursor is currently a blinking bar as I set in the configuration for WT.
Then enter Ubuntu by entering wsl.
Open nvim.
Quit it.
Quit WSL.

https://user-images.githubusercontent.com/24851999/177004315-ef88ec13-1651-4872-ad1b-13844f4fa14b.mp4

Expected Behavior

The cursor should be stored to a blinking bar immediately after I quit Neovim.

Actual Behavior

The cursor continues to be a white block.
It seems that after Neovim changed the shape of the text input cursor, Windows Terminal didn't change it back.

Originally created by @thezbm on GitHub (Jul 2, 2022). ### Windows Terminal version 1.13.11432.0 ### Windows build number 10.0.22000.0 ### Other Software Ubuntu 22.04 LTS Neovim v0.7.0 ### Steps to reproduce The cursor is currently a blinking bar as I set in the configuration for WT. Then enter Ubuntu by entering `wsl`. Open `nvim`. Quit it. Quit WSL. https://user-images.githubusercontent.com/24851999/177004315-ef88ec13-1651-4872-ad1b-13844f4fa14b.mp4 ### Expected Behavior The cursor should be stored to a blinking bar immediately after I quit Neovim. ### Actual Behavior The cursor continues to be a white block. It seems that after Neovim changed the shape of the text input cursor, Windows Terminal didn't change it back.
claunia added the Needs-TriageIssue-BugNeeds-Tag-Fix labels 2026-01-31 05:56:08 +00:00
Author
Owner

@j4james commented on GitHub (Jul 2, 2022):

I'm afraid this is known issue with neovim (see https://github.com/neovim/neovim/issues/4396), and their recommended workaround is to reset the cursor manually with a VimLeave handler.

See also #9081.

@j4james commented on GitHub (Jul 2, 2022): I'm afraid this is known issue with neovim (see https://github.com/neovim/neovim/issues/4396), and their recommended workaround is to reset the cursor manually with a `VimLeave` handler. See also #9081.
Author
Owner

@thezbm commented on GitHub (Jul 2, 2022):

I'm afraid this is known issue with neovim (see neovim/neovim#4396), and their recommended workaround is to reset the cursor manually with a VimLeave handler.

See also #9081.

Oh, I see. Thanks for your time. I managed to fix it with a VimLeave autocmd.
See #4867 for more information.

@thezbm commented on GitHub (Jul 2, 2022): > I'm afraid this is known issue with neovim (see [neovim/neovim#4396](https://github.com/neovim/neovim/issues/4396)), and their recommended workaround is to reset the cursor manually with a `VimLeave` handler. > > See also #9081. Oh, I see. Thanks for your time. I managed to fix it with a `VimLeave` autocmd. See [#4867](https://github.com/neovim/neovim/issues/4867) for more information.
Author
Owner

@awa5114 commented on GitHub (Mar 23, 2023):

@j4james what if I'm using neovim?

@awa5114 commented on GitHub (Mar 23, 2023): @j4james what if I'm using neovim?
Author
Owner

@j4james commented on GitHub (Mar 23, 2023):

@j4james what if I'm using neovim?

@amine-aboufirass I don't understand what you're asking. The issue I linked above, and the suggested workaround is for neovim.

@j4james commented on GitHub (Mar 23, 2023): > @j4james what if I'm using neovim? @amine-aboufirass I don't understand what you're asking. The issue I linked above, and the suggested workaround _is_ for neovim.
Author
Owner

@awa5114 commented on GitHub (Apr 9, 2023):

@j4james I see, I misread your comment.

I have tried opening an nvim instance on Windows Terminal (no WSL) and then doing :au VimLeave * set guicursor=a:block-blinkon0. When I :q! out of nvim I unfortunately see the same behavior and the cursor doesn't change back.

@awa5114 commented on GitHub (Apr 9, 2023): @j4james I see, I misread your comment. I have tried opening an `nvim` instance on Windows Terminal (no WSL) and then doing `:au VimLeave * set guicursor=a:block-blinkon0`. When I `:q!` out of `nvim` I unfortunately see the same behavior and the cursor doesn't change back.
Author
Owner

@j4james commented on GitHub (Apr 9, 2023):

I have tried opening an nvim instance on Windows Terminal (no WSL) and then doing :au VimLeave * set guicursor=a:block-blinkon0.

Note that what you're requesting there is a block cursor that doesn't blink. If that's not the style you want it changed back to, it's obviously not going to work. For example, if you want to change it back to a horizontal bar that does blink, you'd need to do something like this:

:au VimLeave * set guicursor=a:hor1-blinkon1

If you don't want to have to specify the exact cursor type, and just want it changed back to whatever you've configured in the Windows Terminal settings, I don't know of an easy way to do that, but one of the suggestions in the nvim issue tracker was this:

:au VimLeave * set guicursor= | call chansend(v:stderr, "\x1b[ q")

That said, if you're not using the WSL version of nvim, I'm not which of these options will work, if any.

@j4james commented on GitHub (Apr 9, 2023): > I have tried opening an `nvim` instance on Windows Terminal (no WSL) and then doing `:au VimLeave * set guicursor=a:block-blinkon0`. Note that what you're requesting there is a block cursor that doesn't blink. If that's not the style you want it changed back to, it's obviously not going to work. For example, if you want to change it back to a horizontal bar that _does_ blink, you'd need to do something like this: :au VimLeave * set guicursor=a:hor1-blinkon1 If you don't want to have to specify the exact cursor type, and just want it changed back to whatever you've configured in the Windows Terminal settings, I don't know of an easy way to do that, but one of the suggestions in the nvim issue tracker was this: :au VimLeave * set guicursor= | call chansend(v:stderr, "\x1b[ q") That said, if you're not using the WSL version of nvim, I'm not which of these options will work, if any.
Author
Owner

@BoscoDomingo commented on GitHub (Jan 16, 2025):

For reference to anyone googling this issue: I fixed it by setting my cursor to be a line (same as I use in my Windows Terminal). No need for an autocmd. In my init.lua:

vim.opt.guicursor = "a:ver30-Cursor-blinkwait700-blinkon400-blinkoff250"

Reference

@BoscoDomingo commented on GitHub (Jan 16, 2025): For reference to anyone googling this issue: I fixed it by setting my cursor to be a line (same as I use in my Windows Terminal). No need for an autocmd. In my `init.lua`: ``` vim.opt.guicursor = "a:ver30-Cursor-blinkwait700-blinkon400-blinkoff250" ``` [Reference](https://vimhelp.org/options.txt.html#%27guicursor%27)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#17846