terminal: Vim Cursor shape stays underscore. Not able to change it
From @ponegan on January 9, 2018 6:40
-
Your Windows build number: (Type
ver
at a Windows Command Prompt) Microsoft Windows [Version 10.0.16299.125] -
What you’re doing and what’s happening / What’s wrong / what should be happening instead: I’m using xterm-256color. I had been tried to change the shape of my vim cursor. I tried lots of different configuration for cursor shape (to be block) but none of them works as I put them in my .vimrc.
For example I tried some of these: http://vim.wikia.com/wiki/Configuring_the_cursor
In the terminal I was able to change the shape of cursor to block by selecting ‘large’ in property as @zadjii-msft suggested in #1253. But the same trick won’t work for vim. Well… it will work at the moment I set it to ‘large’. But it will reset back to underscore every time I open another file.
As this:
Anyone got a good approach on this cursor configuration?
Copied from original issue: Microsoft/WSL#2821
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 8
- Comments: 40 (8 by maintainers)
@tuyenpm9 that’s no $PS1, that’s a %PROMPT% setting in CMD: https://github.com/zadjii/keep/blob/master/bin/reprompt.cmd#L33
Also, I’m certain support for this is in Insider’s (at the very least). How are you setting your cursor shape in vim?
I know that this method works at the very least: http://vim.wikia.com/wiki/Change_cursor_shape_in_different_modes#For_Terminal_on_macOS
Got block/bar cursor working in powershell, cmd, and wsl with :
Note spaces before the control sequence in the win32 terminal configuration. A few quirks but all in all much better than the cursor not indicating the current mode
Microsoft Windows [Version 10.0.18362.657] 1903 VIM - Vi IMproved 8.1 (2018 May 18, compiled May 18 2018 18:26:56)
WSL - Ubuntu 18.04.4 LTS VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 06 2019 17:31:41)
@p-groarke Thanks for the kind words, but please stop being nice to our dev’s - it makes them all happy and distracts them from their long list of bugs & features.
Back to your keyboard @zadjii-msft or I’ll have to put you on notice again 😉
Oh yea! I added support for cursor shapes, colors for RS5. If vim’s using them to set the shape, then they should work. It’s on it’s way to Insiders now 😃
I’ve never been able to get the cursor change working in vim.exe and I don’t know why. I mostly use neovim, and it does work there, so I think this is a vim issue now.
Edit - just experimented a bit, it sort of works this way, but the screen gets glitchy for me:
This is I suppose tangental to the issue, but I really want the cursor to change in vim. I don’t know how to get 1809. I’m on 1803 (17134.556), and there is no update available. I tried doing that insiders program, but after doing the link my account go get started, it just does a little spin, then my account never gets added. Maybe because it’s an azure vm and/or the account is an alias(at)microsoft.com there is some restriction? (sorry I have no real idea how to use windows, which is why I’m clinging to vim and wsl as much as I can 😉 )
Wow the command prompt team keeps delivering time and time again. What a time to be alive! Thanks for all the great work.
Sure but not being able to distinguish between insert and command mode is annoying
Update: My strange solution is broken/not necessary now (don’t know since when). The following works when sourced, but not when autoloaded as vimrc. I have no idea what’s going on.
(I still see the visual bug for
r
)Also can add
autocmd VimLeave * silent !echo -ne "\x1b[\x35 q"
or any value x31-x35 to set the cursor back to your default after exiting vimThanks for this, but somehow, it doesn’t work when
set termguicolors
is enabledThat’s because we’re the best 😛
As a teaser, here’s a pic of a vertical bar cursor in a pleasing cyan:
Of course, there are other shapes too if you so choose. That’s just my default.