Changing the cursor appearance in Visual Studio Code via extension API

w.brian picture w.brian · Nov 24, 2015 · Viewed 7.3k times · Source

Is it possible to change the cursor appearance in Visual Studio Code using the extensions API? Knowing that VS Code is built on top of Chromium, and that there isn't a way to style the text cursor in a browser using CSS, it wouldn't seem likely.

I'm messing around and trying to implement some simple modal editing, and I would like to create a block cursor like vim in normal mode.

Answer

Dan Bechard picture Dan Bechard · Nov 25, 2016

I'm not sure about using the extension API, but you can do it via your user preferences file (which extensions must be able to modify because the "Vim" extension does it as mentioned in my comment above):

File -> Preferences -> User Settings

Place the following in settings.json:

// Place your settings in this file to overwrite the default settings
{
    // Controls the cursor style, accepted values are 'block', 'line' and 'underline'
    "editor.cursorStyle": "block"
}