6

Is there any way to change the cursor shape within Windows Subsystem for Linux terminal? I'd like my cursor to reflect the state I'm in in vim or vi-mode.

In Git Bash for example I can use echo -ne "\e[2 q" and echo -ne "\e[6 q" to switch between block and line cursor. These don't seem to have any effect in WSL.

3 Answers 3

1

I'm assuming that you are using Bash through the default terminal window that comes with WLS.

If so then you will need to replace that terminal as it is not capable of understanding the special escape sequences. The only way I know to do this is to install a GUI such as Unity or XFCE4 and then install your preferred terminal emulator. This link will tell you how to do that.

This is probably overkill just for changing the cursor but it does have other advantages too, with a GUI installed you can now run many other Linux apps, not all work 100% but most will work fine, you can even set up a unified desktop with a Linux task bar and a windows task bar all on one screen.

1
  • Also, 1.5 years later, using the current version of WSL, the cursor shape can now be changed when run e.g. inside ConEmu.
    – ilves
    Jan 29, 2018 at 16:28
6

Since now there is an option for this, I would like to share it here

In settings.json of windows terminal you can set

        "cursorColor" : "#FFFFFF",
        "cursorShape": "filledBox",

inside the "profiles"

Taken from https://docs.microsoft.com/pt-br/windows/terminal/custom-terminal-gallery/retro-command-prompt

2
  • settings.json may be found in [drive]:\Users[username]\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json
    – kjl
    Oct 10, 2022 at 4:02
  • And a simpler solution may be found at thewindowsclub.com/…
    – kjl
    Oct 10, 2022 at 4:16
5

Under Settings -> Profiles (either in "Defaults" for all, or pick a specific profile) -> Additional Settings -> Appearance -> Cursor -> Cursor Shape. Set to "filled box" or whatever you prefer.

(I'm guessing this was not available in GUI when other people answered this, e.g. an answer from two years ago says you have to set it in JSON. You can now change it in the GUI, at least as of Windows 11.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .