kevin
kevin

Reputation: 1157

Is it possible to have a block cursor in sublime text 3?

Not sure it is most appropriate to post it here. I don't find it on either Sublime's official/unofficial documents or the web.

Anyone has a solution to have a vim/terminal type block cursor in sublime text?

Any suggestion is welcome. Thank you in advance.

Upvotes: 20

Views: 13832

Answers (6)

Mason Stewart
Mason Stewart

Reputation: 868

This is now possible as of Build 3190 (from 19 February 2019). You can enable this with

"block_caret": true

in your user settings. Your theme may not have a style for this, so if the default color of the caret isn't to your liking, it can be changed in your theme by adding

<key>blockCaret</key>
<string>#FFCC00</string>

into your theme's settings section. It will look something like this:

block_caret example image

Upvotes: 11

tisuchi
tisuchi

Reputation: 954

It's simply based on your preference. This method is called Caret in Sublime Text. Go to Preferences > Settings – User and add following lines-

"caret_style": "phase",

"caret_extra_bottom": 0,
"caret_extra_top": 30,
"caret_extra_width": 2,

"line_padding_bottom": 5,
"line_padding_top": 10,

All the values are based on your preferences.

Upvotes: 3

Lee Goddard
Lee Goddard

Reputation: 11173

Just edit caret_extra_width to be about 10, or the size of your font.

Upvotes: 0

kevin
kevin

Reputation: 1157

I figured out by looking at some settings in afterglow - twilight, these lines in the color themes would work well with caret_inverse_style: true

<dict>
    <key>settings</key>
    <dict>
        <key>background</key>
        <string>#2E2E2E</string>
        <key>caret</key>
        <string>#4169E1</string>
        <key>foreground</key>
        <string>#d6d6d6</string>
        <key>invisibles</key>
        <string>#FFFFFF40</string>
        <key>lineHighlight</key>
        <string>#FFFFFF08</string>
        <key>selection</key>
        <string>#4169E1</string>
    </dict>
</dict>

specifically, the "caret color" will be the color of the caret, and the "selection" color will be the background of the area of the caret (similar to a block cursor.

Upvotes: 4

Saad
Saad

Reputation: 53889

You can try out the package that @user2365566 mentioned. I personally didn't like the way that cursor looked.

Here is an alternative, just add following into your Preferences.sublime-settings:

{
    "caret_extra_width": 5,
    "caret_style": "solid",
    "wide_caret": true
}

You can change the caret_extra_width number to whatever you like, based on how wide you want the cursor to be.

Upvotes: 19

Englund
Englund

Reputation: 1127

As far as i know there is no way to do this in ST3 right out of the box at the moment.

There are however packages such as https://github.com/karlhorky/BlockCursorEverywhere that should solve your problem.

Upvotes: 8

Related Questions