March 22, 2021

Text Editor Preferences

I came across two articles which intrigued me.

Nova Review: Panic’s Code Editor Demonstrates Why Mac-like Design Matters - MacStories

I looked at Nova and came to the conclusion that it wasn’t for me. I am not a programmer, code is not my focus. I want a capable text editor and Nova was focused on code. But the descriptor “Mac-like,” got my attention.

What is “Mac-like?” I have been thinking about this for a few days now. I know it when it is not “Mac-like.” Try any Java app and you will know what I am mean. But those are the extremes. What distinguishes one product from another in terms of “Mac-likeness?”

The easy criterion is an evaluation of the support of macOS technologies. Does it support the Services menu? Does it support Versions? Is it integrated with the OS, or does it stand on its own? There are several of these that you can use to determine whether a program is “Mac-like” or not.

The focus of the article is “Mac-like design.” What is that? They look the same to me.

This is Sublime Text editing this article.

Sublime TextSublime Text

BBEdit editing this article.

BBEditBBEdit

This is iA Writer with the same article.

iA WriteriA Writer

Jason Snell, a respected member of the macOS community, in Mac apps yes, text preferences no – Six Colors, focused on the following paragraph:

One of my main frustrations with pretty much all of the popular code editors out there (and I’ve tried most of them, including Visual Studio Code, Sublime Text, Atom, IntelliJ, and Eclipse) is that none of them are Mac-assed Mac apps. They’re all clearly cross-platform apps with design senses that differ significantly from those of Mac-first developers.

You can see a microcosm of this fact just by looking at the preferences of these apps. For many of them, the ‘Preferences’ menu bar item is actually a submenu from which you can navigate to ‘Settings,’ as well as other more nebulous options. If that doesn’t already offend Mac users, a common theme in those settings screens is for them to be literal JSON text files that open in the editor. You then manually edit the text to adjust options.

His comment?

As Alex writes, design matters, Mac-like design doubly so. And if an app decides to display its preferences as an editable text file, I’m never going to use that app. Hard No.

I find myself compelled to write about the efficiency of using text files as preferences for complex programs like a text editor. This gives me an opportunity to write about the preferences of Sublime Text.

The Sublime Text Preference Setup

Sublime Text has preferences it codifies in JSON files. There are a plethora of these.

  1. The Default Settings file and a User Default settings file
  2. The Language-Specific settings file and the User Language-Specific settings file
  3. The Distraction Free settings file
  4. Each package you install can have a default settings file and an User settings file.

Let’s deal with the Default Settings File.

Default Settings File

The Default Settings File in the beta of version 4 of Sublime Text is 780 lines of commented JSON goodness.

For instance,

    // Set to false to prevent line numbers being drawn in the gutter
    "line_numbers": true,

    // Set to false to hide the gutter altogether
    "gutter": true,

You don’t edit the default settings file. If you want to change the default behavior, you add the setting to your personal settings file. For instance.

    // Set to false to prevent line numbers being drawn in the gutter
    "line_numbers": false,

    // Set to false to hide the gutter altogether
    "gutter": false,

You would add the previous section to your personal settings file to ensure no line numbers and no gutters.

Another example:

    // Disables horizontal scrolling if enabled.
    // May be set to true, false, or "auto", where it will be 
    // disabled for source code, and otherwise enabled.
    "word_wrap": "auto",

    // Set to a value other than 0 to force wrapping at that column 
    // rather than the window width. See "wrap_width_style" for 
    // extra options.
    "wrap_width": 0,

This is the section which defines the properties of word_wrap. Or how or where you want the word-wrapping to work.

My settings:

    "word_wrap": true,
    "wrap_width": 90,

I want word wrapping to be on and to wrap with 90 characters on a line.

This is my settings file:

{
    //Words added to the dictionary
    "added_words":
    [
        "blog",
        "workflow",
        "Facebook",
        "hoodie",
        "github",
        "macosxguru",
        "gmail",
        "thingie",
        "Deselect",
        "Mamoni",
        "Solarized",
        "Obama",
        "Pastebot",
        "Dropbox",
        "overthinking",
        "wasn’t",
        "didn’t",
        "couldn’t",
        "hadn’t",
        "wouldn’t",
        "aren’t",
        "isn’t",
        "weren’t",
        "amongst",
        "doesn’t",
        "shouldn’t",
        "hasn’t",
        "monospace",
        "enduringly",
        "Keychron",
        "workspaces",
        "outliner",
    ],

    // Controls auto pairing of quotes, brackets etc
    "auto_match_enabled": true,
    //exclude from GoTo searches
    "binary_file_patterns":
    [
        "Public/"
    ],
    //Requirement of MarkdownEditing package
    "blacklist_syntaxes":
    [
        "Markdown"
    ],
    //look of folders in the sidebar
    "bold_folder_labels": true,
    //look of caret
    "caret_extra_bottom": 5,
    "caret_extra_top": 5,
    "caret_extra_width": 2,
    "caret_style": "wide",

    "color_inactive_tabs": true,
    //default theme and color_scheme
    "color_scheme": "Packages/Color Scheme - Default/Breakers.sublime-color-scheme",
    "theme": "Adaptive.sublime-theme",
    // Draws text centered in the window rather than left aligned
    "draw_centered": true,
    "draw_white_space": "none",
    "enable_live_count": true,
    "fade_fold_buttons": false,
    //files to exclude from side bar
    "file_exclude_patterns":
    [
        "*.pdf",
        "*.dropbox",
        "*.nottingham",
        "*.ark",
        "*.reportark",
        "*.png",
        "*.gif",
        "*.jpg",
        "*.exe",
        "*.dll",
        "*.obj",
        "*.swf",
        "*.dbf",
        "*.lib",
        "*.cdx",
        "*.cfr",
        ".UlyssesRoot",
        "*.ico",
        "*.lnk",
        "*.bak",
        "*.sig",
        "*.xls",
        "*.doc",
        "*.docx",
        "*.xlsx",
        "*.xps",
        ".DS_Store",
        "*.class",
        "*.psd",
        ".Ulysses-Group.plist",
        ".zedstate",
        ".EagleFiler Metadata.plist",
        "*.db"
    ],
    //font and size
    "font_face": "Input Mono Narrow",
    "font_size": 18,

    "highlight_line": false,
    "highlight_modified_tabs": "enabled",
    
    //default packages which are ignored by me
    "ignored_packages":
    [
        "2pdf",
        "ActionScript",
        "ASP",
        "Batch File",
        "C#",
        "C++",
        "Clojure",
        "CSS3",
        "D",
        "Erlang",
        "Go",
        "Graphviz",
        "Groovy",
        "Haskell",
        "HTML5",
        "Java",
        "Lisp",
        "Markdown",
        "Matlab",
        "Objective-C",
        "OCaml",
        "Pascal",
        "R",
        "Scala",
        "SublimeCodeIntel",
        "TCL",
        "Text Pastry",
        "Textile",
        "Vintage",
    ],
    //Words Ignored by the spell check
    "ignored_words":
    [
        "Das",
        "Devonthink",
        "Sensei",
        "Slugline",
        "Typora",
        "app",
        "backend",
        "brainer",
        "fn",
        "freeform",
        "screenshots",
        "solarized",
        "spellcheck",
    ],
    "keymaps":
    {
        "show_pretty_keys": true,
    },
    "line_numbers": true,
    "line_padding_bottom": 6,
    "line_padding_top": 6,
    "match_brackets": true,
    "match_brackets_angle": true,
    "match_brackets_braces": true,
    "match_brackets_content": true,
    "match_brackets_square": true,
    "mini_diff": false,
    
    //Required by OpenWith plugin. I can open a file in another editor.
    "open_with":
    [
        {
            "command":
            [
                "open",
                "-a",
                "BBEdit",
                "{filename}"
            ],
            "name": "BBEdit",
        },
        {
            "command":
            [
                "open",
                "-a",
                "iA Writer",
                "{filename}"
            ],
            "name": "iA Writer",
        },
        {
            "command":
            [
                "open",
                "-a",
                "TaskPaper",
                "{filename}"
            ],
            "name": "TaskPaper",
        }

    ],
    
    //saves the current document when you move away from it
    "save_on_focus_lost": true,
    "scroll_past_end": true,
    "show_git_status": false,
    "show_line_endings": true,
    "spell_check": true,
    "translate_tabs_to_spaces": true,
    "trim_trailing_white_space_on_save": true,
    "word_wrap": true,
    "wrap_width": 90,
    "auto_complete": true
}

The settings are self-evident.

Is this painful? They grow on you. If you spend time with the editor, you aren’t going to consider whether this is “Mac-like” or not. You are going to know how it works and that is the important consideration.

Language Specific Settings

MarkdownEditing - Packages - Package Control, which is the package I use, to write Markdown, supports Markdown, MultiMarkdown, and GFM (Github Flavored Markdown). Each of these variants have their own preference setup. I use MultiMarkdown. I am going to focus on that.

This is my MultiMarkdown specific settings file:

// These settings override both User and Default settings 
// for the MultiMarkdown syntax
{
    "auto_complete_delay": 30000,
    "auto_complete_selector": "source, text",
    "auto_match_enabled": true,
    "color_scheme": "Packages/Color Scheme - Default/Breakers.sublime-color-scheme",
    "theme": "Adaptive.sublime-theme",
    "highlight_line": false,
    "highlight_modified_tabs": true,
    "bold_folder_labels": true,
    "enable_table_editor": true,
    "extensions":
    [
        "mmd",
        "mdown",
        "md",
    ],
    "font_face": "Input Mono Narrow",

    "font_options":
    [
        "subpixel_antialias",
        "no_round",
        "directwrite"
    ],
    "font_size": 18,
    "line_numbers": true,
    "line_padding_bottom": 6,
    "line_padding_top": 6,
    "mde_match_header_hashes": false,
    "save_on_focus_lost": true,
    "spell_check": true,
    "table_editor_syntax": "Auto",
    "translate_tabs_to_spaces": true,
    "trim_trailing_white_space_on_save": false,
    "word_wrap": true,
    "show_git_status": "false",
    "mini_diff": "false",
    "wrap_width": 90

}

Not complicated. Takes getting used to but the settings are self-evident. And customizable by variant of Markdown. Some of the settings are duplicates of my default setup but I include them in the MultiMarkdown settings because I like them and don’t want them to change if I change the default.

The Sublime Text preferences allows me to customize the environment depending on the file I am editing or the syntax I am using. For instance, I deal with TaskPaper files in Sublime Text and for that I have a different font and a different theme from the one I use with MultiMarkdown files.

Distraction Free Settings

Sublime Text has a different set of settings for the distraction free mode.

{
    "font_face": "Input Mono Narrow",
    "font_size": 20,
    "font_options":
    [
        "subpixel_antialias",
        "no_round",
        "directwrite"
    ],
    "color_scheme": "Packages/Color Scheme - Default/Mariana.sublime-color-scheme",
    "theme": "Default Dark.sublime-theme",
    "wrap_width": 90,
    "line_numbers": true,
    "gutter": false,
    "save_on_focus_lost": true,
    "auto_complete_selector": "source, text",
    "auto_complete": true,
    "typewriter_mode_scrolling": true

}

One of the advantages of Sublime Text is that I can activate typewriter scrolling only in full screen mode. In regular windows, typewriter scrolling isn’t active.

Tweaking themes

I like the default theme that Sublime Text ships with. But I don’t like the color of the cursor. I want to change that, but I don’t want to have to change the theme for every update of Sublime Text. I don’t have to worry about that anymore. Sublime Text lets me edit the default themes and keeps the edits in a User Settings file, separate from the theme file. When Sublime Text gets updated, my theme changes stay the way I had set it up.

These are my changes to the default theme:

// Documentation at https://www.sublimetext.com/docs/color_schemes.html
{
    "variables":
    {
            "blue3": "hsl(198, 100%, 56%)",
    },
    "globals":
    {
        "caret": "var(blue3)",
    },
    "rules":
    [

    ]
}

I got the iA Writer caret into my theme. I am pushing the blue cursor across the screen.

The Modern Text Editor

BBEdit is the benchmark when it comes to the descriptor of a Mac text editor. It has a long history of being the text editor in the Mac market.

Explanations for the Preferences are on Page 219-248 in BBEdit User Manual(13.5.1). That is 29 pages of explanations for what the settings do. In addition, there are, what BBEdit calls Expert Preferences. These are statements which you have to input in the Terminal to get particular behavior that you are interested in.

BBEdit is defined by the continuous iteration it has gone through. Everything has been tweaked and polished to arrive at this state.

The preferences are well-designed, comprehensive and, if I may say so, “Mac-like.” They are so only because of the heritage of BBEdit, not because it is “Mac-like” to tweak default statements in the Terminal.

The modern text editor is a complicated beast and developers are trying to design a preference system which consumers can understand and use. The ability to set your preferences for the editor in a text file is an attempt to do that. It is different from the approach that BBEdit uses, but it is not an aberration. The Unix ethos which is fundamental to the modern day macOS, is equipped with two text editors, Vim and Emacs, which both use text file based preference setups.

The consideration should be efficiency and not a nebulous quality like “Mac-like design.”

I have to revert to what I wrote in the last article:

The best text editor is the one you know how to use.

If you are happy with the text editor you are using, keep typing. Spare me the assertions about what is “Mac-like design” and what isn’t.

macosxguru at the gmail thingie.


text editor macOS Sublime Text


Previous post
The One Text Editor I have been looking for the one text editor that I can use for all my writing. One text editor. For all my files. I write notes. I maintain a few
Next post
TaskPaper - The Text-Based Outliner Product: TaskPaper Price: $24.99 I was sad to give up on org-mode. Not interested in the task-management aspect of it. Intrigued by the content