Search code examples
jsonsublimetext3

Need help editing "Preferences.sublime-settings - User"


Ok... I'm very new, so please be nice :)

I'm trying to change the cursor, but I don't know how to add the "cursor code" to the "theme code" (monokai pro). The "theme code" is below "cursor code", how do I use both successfully? All I want to do is change the cursor.

How do I add this code (cursor code)

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

To this code (theme code)

{
    "author": "Chris Kempson",
    "color_scheme": "Packages/Theme - Monokai Pro/Monokai Pro.sublime-color-scheme",
    "globals":
    {
        "background": "var(blue5)",
        "caret": "var(white)",
        "foreground": "var(white)",
        "invisibles": "var(blue7)",
        "line_highlight": "var(blue)",
        "selection": "var(blue2)"
    },
    "ignored_packages":
    [
        "Vintage"
    ],
    "name": "Tomorrow Night - Blue",
    "rules":
    [
        {
            "foreground": "var(grey)",
            "name": "Comment",
            "scope": "comment, string.quoted.double.block.python"
        },
        {
            "foreground": "var(white)",
            "name": "Foreground, Operator",
            "scope": "keyword.operator.class, keyword.operator, constant.other, source.php.embedded.line"
        },
        {
            "foreground": "var(red3)",
            "name": "Variable, String Link, Regular Expression, Tag Name",
            "scope": "variable, support.other.variable, string.other.link, string.regexp, entity.name.tag, entity.other.attribute-name, meta.tag, declaration.tag"
        },
        {
            "foreground": "var(orange)",
            "name": "Number, Constant, Function Argument, Tag Attribute, Embedded",
            "scope": "constant.numeric, constant.language, support.constant, constant.character, variable.parameter, punctuation.section.embedded, keyword.other.unit"
        },
        {
            "foreground": "var(orange2)",
            "name": "Class, Support",
            "scope": "entity.name.class, entity.name.type.class, support.type, support.class"
        },
        {
            "foreground": "var(green)",
            "name": "String, Symbols, Inherited Class, Markup Heading",
            "scope": "string, constant.other.symbol, entity.other.inherited-class, markup.heading"
        },
        {
            "foreground": "var(blue6)",
            "name": "Operator, Misc",
            "scope": "keyword.operator, constant.other.color"
        },
        {
            "foreground": "var(white3)",
            "name": "Function, Special Method, Block Level",
            "scope": "entity.name.function, meta.function-call, support.function, keyword.other.special-method, meta.block-level"
        },
        {
            "foreground": "var(white2)",
            "name": "Keyword, Storage",
            "scope": "keyword, storage, storage.type, entity.name.tag.css"
        },
        {
            "background": "var(red2)",
            "foreground": "var(white)",
            "name": "Invalid",
            "scope": "invalid"
        },
        {
            "background": "var(white4)",
            "foreground": "var(white)",
            "name": "Separator",
            "scope": "meta.separator"
        },
        {
            "background": "var(white2)",
            "foreground": "var(white)",
            "name": "Deprecated",
            "scope": "invalid.deprecated"
        },
        {
            "foreground": "var(white)",
            "name": "Diff foreground",
            "scope": "markup.inserted.diff, markup.deleted.diff, meta.diff.header.to-file, meta.diff.header.from-file"
        },
        {
            "foreground": "var(yellow)",
            "name": "Diff insertion",
            "scope": "markup.inserted.diff, meta.diff.header.to-file"
        },
        {
            "foreground": "var(red)",
            "name": "Diff deletion",
            "scope": "markup.deleted.diff, meta.diff.header.from-file"
        },
        {
            "background": "var(blue4)",
            "foreground": "var(white)",
            "name": "Diff header",
            "scope": "meta.diff.header.from-file, meta.diff.header.to-file"
        },
        {
            "font_style": "italic",
            "foreground": "var(blue3)",
            "name": "Diff range",
            "scope": "meta.diff.range"
        },
        {
            "foreground": "var(red4)",
            "name": "diff.deleted",
            "scope": "markup.deleted"
        },
        {
            "foreground": "var(yellow2)",
            "name": "diff.inserted",
            "scope": "markup.inserted"
        },
        {
            "foreground": "var(purple)",
            "name": "diff.changed",
            "scope": "markup.changed"
        }
    ],
    "theme": "Agila.sublime-theme",
    "variables":
    {
        "blue": "#00346e",
        "blue2": "#003f8e",
        "blue3": "#3e999f",
        "blue4": "#4271ae",
        "blue5": "#002451",
        "blue6": "#99ffff",
        "blue7": "#404f7d",
        "green": "#d1f1a9",
        "grey": "#999999",
        "orange": "#ffc58f",
        "orange2": "#ffeead",
        "purple": "#967efb",
        "red": "#c82829",
        "red2": "#f99da5",
        "red3": "#ff9da4",
        "red4": "#f92672",
        "white": "#ffffff",
        "white2": "#ebbbff",
        "white3": "#bbdaff",
        "white4": "#bbdafe",
        "yellow": "#718c00",
        "yellow2": "#a6e22e"
    }
}

Without getting this error message:

Error trying to parse settings: Unexpected trailing characters in Packages/User/Preferences.sublime-settings

Thank you guys!


Solution

  • What you are calling your "cursor code" is actually some preferences. They should be added to your user preferences (available via Preferences → Settings on the right side). Don't erase what's already there, just follow the rules of JSON - start with an opening curly brace { on one line, then have one preference per line with a comma , at the end of each line, then close with a curly brace }. You can have as many preferences set as you want, don't limit it to just those three. Look at the default preferences on the left for a list of every single one that's available. Don't worry if you don't understand what they all mean - you can customize just about every single thing about Sublime!

    As far as the color scheme, which is kind of what your lower piece of code is - the easiest thing to do is to install Monokai Pro from Package Control and ignore that code completely - it's corrupted. If you haven't installed Package Control yet, install it by selecting Tools → Install Package Control…. Once that's done, hit CtrlShiftP on Windows/Linux, ShiftP on macOS, to open the Command Palette. Type in pci (short for Package Control: Install Package), hit Enter, type in monpro, select Theme - Monokai Pro, and hit Enter again. You may see a message on the status bar (down at the very bottom of the window) saying it's installing.

    Once it installs, select Preferences → Color Scheme…, scroll through the list of options, click on Monokai Pro, hit Enter, and you should be good to go. I know it looks a little complicated, but in reality it's not. Once Package Control is installed, you don't have to install it again (in fact - you can't install it again). You should also learn through this exercise that all Sublime modal menus have fuzzy search, so you can usually just type a couple of letters and the option you want will pop right up.