The letter A styled as Alchemists logo. lchemists Syndication Icon
Published November 27, 2014 Updated November 24, 2021
Sublime Text Setup Icon

Sublime Text Setup

Git Badge
Circle CI Status

Shell scripts for managing and sharing Sublime Text settings, key bindings, extensions, code snippets, and much more. If you are fan of Sublime Text and don’t want to always reconfigure it when reinstalling the operating system on an existing machine or setting up a secondary machine, then having a project as single source of truth is a great way to reduce that maintenance burden while also being able to share your settings with others.

Features

  • Applies preferences not enabled by default (see the Preferences.sublime-settings file).

  • Applies key bindings not enabled by default (see the Default (OSX).sublime-keymap file).

  • Applies extension preferences not enabled by default (see the macOS Configuration project for details.)

  • Provides tab-completion code snippets for HTML, CSS, Elm, Ruby, Rails, RSpec, Rust, etc.

Requirements

Setup

To install, run:

git clone https://github.com/bkuhlmann/sublime_text_setup.git
cd sublime_text_setup
git checkout 18.2.0

Usage

Start by installing Package Control if you haven’t already. The quick steps are:

  1. Open the command palette via COMMAND + SHIFT + p.

  2. Type Install Package Control and press ENTER to install.

Now you can switch to your terminal and type the following install:

bin/run

The install assumes this GitHub project will be kept locally since the Sublime Text $HOME/Library/Application Support/Sublime Text/Packages/User folder will be symbolically linked to this project. Should this project be relocated, re-run the install to fix the symbolic link. Alternatively, the install can be skipped and content can be pilfered from the files located in the preferences folder of this project instead.

Customization

Modify all files in the preferences/User folder as you see fit.

For additional setup/support, the following projects might be of interest as well:

  • macOS - Shell scripts for automated macOS machine setup (includes installation of Sublime Text Extensions).

  • Sublime Text Kit - Command line utilities (Ruby Gem) for managing Sublime Text.

Snippets

The following snippets are supported by this project. Each is sorted by description and followed by the trigger to activate the snippet.

  • Bash Header - bashh

  • Bash Settings - bashs

  • Bundler Gem - bg

  • Bundler Inline - bi

  • CSS Border Radius - br

  • CSS Comment - comment

  • CSS Flexbox - flex

  • CSS Grid - grid

  • CSS Grid Area - ga

  • CSS Grid Auto Flow - gaf

  • CSS Grid Gap - gg

  • CSS Grid Template - gt

  • CSS Grid Template Areas - gta

  • CSS Grid Template Columns - gtc

  • CSS Grid Template Rows - gtr

  • CSS Media (breakpoint) - mbp

  • CSS Root - root

  • CSS Style - cs

  • CSS Variable - var

  • CSS Variable (define) - varc

  • Comment (TODO) - todo

  • Comment (duplicate) - dup

  • Comment (fix) - fix

  • ERB - erb

  • ERB Comment - erbc

  • ERB Output - erbo

  • ERB each do..end - erbe

  • ERB if..else..end - erbie

  • ERB link_to - erbl

  • Elm Case - case

  • Elm Case (Response) - cr

  • Elm Case Branch (Response) - cbr

  • Elm Comment (multiple lines) - comment

  • Elm Debug - debug

  • Elm Debug (crash) - debugc

  • Elm Debug (log) - debugl

  • Elm Describe - describe

  • Elm Documentation (multi-line) - docm

  • Elm Documentation (single line) - doc

  • Elm Fix Comment - fix

  • Elm Function - fnn

  • Elm Function (API Read) - fnapir

  • Elm Function (API Write) - fnapiw

  • Elm Function (Anonymous) - fna

  • Elm HTML Aside - aside

  • Elm HTML Div - div

  • Elm HTML Header - footer

  • Elm HTML Header - header

  • Elm HTML Node - nd

  • Elm HTML Section - section

  • Elm If - if

  • Elm It - it

  • Elm Let - let

  • Elm Maybe (block) - mayb

  • Elm Maybe (line) - mayl

  • Elm Module - mod

  • Elm Record - rec

  • Elm Record - Multiple Line - recm

  • Elm Record Update - recu

  • Elm Template (API Client) - ttac

  • Elm Template (HTML Application) - ttha

  • Elm Template (HTML Component) - tthc

  • Elm Template (HTML Document) - tthd

  • Elm Template (HTML Element) - tthe

  • Elm Template (Navigation Program) - ttnp

  • Elm Template (spec) - tts

  • Elm ToDo Comment - todo

  • Elm Tuple - kv

  • Elm Tuple (multiple line - tupm

  • Elm Tuple (single line) - tup

  • Elm Type - type

  • Elm Type Alias - typea

  • Elm Type Alias (record) - typear

  • Factory Bot Build - fbb

  • Factory Bot Build Stubbed - fbs

  • Factory Bot Create - fbc

  • Factory Bot Trait (multi-line) - fbtm

  • Factory Bot Trait (single line) - fbt

  • HTML Comment - comment

  • JavaScript Catch - catch

  • JavaScript Console Count - ccount

  • JavaScript Console Dir - cdir

  • JavaScript Console Error - cerror

  • JavaScript Console Info - cinfo

  • JavaScript Console Log - clog

  • JavaScript Console Time - ctime

  • JavaScript Console Time End - ctimee

  • JavaScript Console Trace - ctrace

  • JavaScript Console Warn - cwarn

  • JavaScript Event Listener - eventl

  • JavaScript Function - fn

  • JavaScript Function (anonymous) - fna

  • JavaScript Function (async) - afn

  • JavaScript Port (Elm) - port

  • JavaScript Setter - getter

  • JavaScript Setter - setter

  • JavaScript Switch - switch

  • JavaScript Then - then

  • JavaScript Try - try

  • RSpec After (multi-line) - afterm

  • RSpec After (single line) - after

  • RSpec Aggregate Failures - ag

  • RSpec Allow - al

  • RSpec Allow Block (multi-line) - albm

  • RSpec Allow Block (single line) - alb

  • RSpec Allow Error - ale

  • RSpec Allow Original - alo

  • RSpec Allow Original Wrap - alow

  • RSpec Allow Return - alr

  • RSpec Allow Throw - alt

  • RSpec Allow With - alw

  • RSpec Allow With Error - alwe

  • RSpec Allow With Return - alwr

  • RSpec Allow With Throw - alwt

  • RSpec Allow With Yield - alwy

  • RSpec Allow Yield - aly

  • RSpec Around - around

  • RSpec Before (multi-line) - beforem

  • RSpec Before (single line) - before

  • RSpec Class Double - cdouble

  • RSpec Class Spy - cspy

  • RSpec Context - context

  • RSpec Describe - des

  • RSpec Described Class - dc

  • RSpec Expect - x

  • RSpec Expect - Change - xc

  • RSpec Expect - Contain Exactly - xx

  • RSpec Expect - Cover - xv

  • RSpec Expect - Eq - xq

  • RSpec Expect - Have Attributes - xa

  • RSpec Expect - Have Received - xr

  • RSpec Expect - Include - xi

  • RSpec Expect - Match - xm

  • RSpec Expect - Output - xo

  • RSpec Expect - Raise Error - xe

  • RSpec Expect - Throw - xt

  • RSpec Expect - Within - xw

  • RSpec Expect - Yield Control - xyc

  • RSpec Expect - Yield Successive Args - xys

  • RSpec Expect - Yield With Args - xya

  • RSpec Feature - feature

  • RSpec Helper - rsh

  • RSpec Include Context - inc

  • RSpec Include Examples - ine

  • RSpec Instance Double - idouble

  • RSpec Instance Spy - ispy

  • RSpec It (block) - itb

  • RSpec It (multi-line) - itm

  • RSpec It (single line) - it

  • RSpec It Behaves Like (multi-line) - itlm

  • RSpec It Behaves Like (single line) - itl

  • RSpec Let (multi-line) - letm

  • RSpec Let (single line) - let

  • RSpec Matcher - matcher

  • RSpec Matcher (argument) - matchera

  • RSpec Mock With Temporary Scope - mope

  • RSpec Object Double - odouble

  • RSpec Object Spy - ospy

  • RSpec Pending (multi-line) - pendm

  • RSpec Pending (single line) - pend

  • RSpec Scenario - scenario

  • RSpec Shared Context - sharedc

  • RSpec Shared Examples - sharede

  • RSpec Skip (multi-line) - skipm

  • RSpec Skip (single line) - skip

  • RSpec Subject (multi-line) - subjectm

  • RSpec Subject (single line) - subject

  • Rails Controller - controller

  • Rails Enum - enum

  • Rails Job - job

  • Rails Migration - rm

  • Rails Migration (ID) - rmid

  • Rails Migration (Index) - rmx

  • Rails Migration (JSON) - rmj

  • Rails Migration (array) - rma

  • Rails Migration (boolean) - rmb

  • Rails Migration (datetime) - rmdt

  • Rails Migration (decimal) - rmd

  • Rails Migration (hash) - rmh

  • Rails Migration (image) - rmimg

  • Rails Migration (integer) - rmi

  • Rails Migration (string) - rms

  • Rails Migration (text) - rmt

  • Rails Migration (timestamps) - rmts

  • Rails Scope - scope

  • Reek Disable - rd

  • Rubocop (disable) - copd

  • Rubocop (enable) - cope

  • Rubocop (todo) - copt

  • Ruby Attribute (accessor) - ata

  • Ruby Attribute (reader) - atr

  • Ruby Attribute (writer) - atw

  • Ruby Benchmark IPS - bmi

  • Ruby Benchmark Mem - bmm

  • Ruby Benchmark Report (multi-line) - reportm

  • Ruby Benchmark Report (single line) - report

  • Ruby Breakpoint - bp

  • Ruby Breakpoint Tap - bpt

  • Ruby Case (in) - ci

  • Ruby Case (when) - cw

  • Ruby Class - class

  • Ruby Class (anonymous) - classa

  • Ruby Curry - cy

  • Ruby Delegate - dele

  • Ruby Delegate (class) - delc

  • Ruby Delegate (simple) - dels

  • Ruby Dry Container - Dependencies - dcd

  • Ruby Dry Container - Extend - dce

  • Ruby Dry Container - Include - dci

  • Ruby Dry Container - Register - dcr

  • Ruby Dry Container - Super - dcs

  • Ruby Dry Validation - Contract - dvc

  • Ruby Dry Validation - JSON - dvj

  • Ruby Dry Validation - Optional - dvo

  • Ruby Dry Validation - Params - dvp

  • Ruby Dry Validation - Required - dvr

  • Ruby Dry Validation - Rule - dvu

  • Ruby Dry Validation - Schema - dvs

  • Ruby Encoding - encode

  • Ruby Fail - fail

  • Ruby Fail - Not Implemented - failn

  • Ruby Fetch (multi-line) - fetchm

  • Ruby Fetch (single line) - fetch

  • Ruby Forwardable - forward

  • Ruby Frozen String Literals - fsl

  • Ruby Function (argument) - fna

  • Ruby Function (empty) - fne

  • Ruby Function (multi-line) - fnm

  • Ruby Function (symbol-to-proc) - fns

  • Ruby Heredoc - doc

  • Ruby If (multi-line) - ifm

  • Ruby Initialize - init

  • Ruby Initialize (body) - initb

  • Ruby Instance Assign - ia

  • Ruby Keyword - kw

  • Ruby Lambda (multi-line) - ldm

  • Ruby Lambda (single line) - ld

  • Ruby Log - log

  • Ruby Memory Profiler - mp

  • Ruby Method - def

  • Ruby Method (call) - cef

  • Ruby Method (call, endless) - cee

  • Ruby Method (endless) - dee

  • Ruby Method (self) - sef

  • Ruby Method (self, endless) - see

  • Ruby Middleware - mid

  • Ruby Module - mod

  • Ruby Module (function) - modf

  • Ruby Module (self) - mods

  • Ruby Namespace - namespace

  • Ruby Proc (multi-line) - procm

  • Ruby Proc (single line) - proc

  • Ruby Reduce (multi-line) - reducem

  • Ruby Reduce (single line) - reduce

  • Ruby Reduce (with index) - reducei

  • Ruby Refine - refine

  • Ruby Regex (multi-line) - rxm

  • Ruby Script Header - head

  • Ruby Shortcut (multi-line) - scm

  • Ruby Shortcut (single line) - sc

  • Ruby Struct (initialize) - sinit

  • Ruby Struct (multi-line) - structm

  • Ruby Struct (single line) - struct

  • Ruby Struct Instance Assign - sia

  • Ruby Sum - sum

  • Ruby Tap (argument) - tpa

  • Ruby Tap (empty) - tpe

  • Ruby Tap (multi-line) - tpm

  • Ruby Tap (symbol-to-proc) - tps

  • Ruby Then (arguments) - tna

  • Ruby Then (multi-line) - tnm

  • Ruby Then (symbol-to-proc) - tns

  • Ruby Trap (multi-line) - trapm

  • Ruby Trap (single line) - trap

  • Ruby Warn (deprecate) - warnd

  • Ruby With Object (multi-line) - withm

  • Ruby With Object (single line) - with

  • Ruby With Object (with index) - withi

  • Rust Function - fn

  • SCSS Image URL (Rails Asset Path) - imgu

  • SCSS Include - in

  • SCSS Mixin - mix

  • SCSS Variable (define) - vars

  • Shell Array - array

  • Shell Array (delete) - arrayd

  • Shell Array (index) - arrayi

  • Shell Array (length) - arrayl

  • Shell Array (offset) - arrayo

  • Shell Case - case

  • Shell For - for

  • Shell Function - fn

  • Shell If - if

  • Shell Print - print

  • Shell Script Header - head

  • Shell Variable Default - vard

  • Shell While - while

  • ShellCheck Disable - scd

Keyboard Shortcuts

All keyboard shortcut settings are defined here:

  • Main Menu → Sublime Text → Preferences → Key Bindings - Default

  • Main Menu → Sublime Text → Preferences → Key Bindings - User

The following is a list of commonly used keyboard shortcuts (including default and custom bindings/remappings):

  • Navigation

    • COMMAND+SHIFT+p = Open command pallet.

    • COMMAND+p = Goto file. Uses fuzzy file name matching logic. Suffix the file name as follows to filter further:

      • : = Goto file line number.

      • @ = Goto file symbol.

      • # = Goto file keyword.

    • COMMAND+k+b = Show/Hide project sidebar.

  • Search

    • COMMAND+f = Full file search (search panel remains open).

    • COMMAND+i = Incremental file search (search panel immediately closes).

    • COMMAND+SHIFT+g = Find previous occurrence of current search.

    • COMMAND+g = Find next occurrence of current search.

    • OPTION+ENTER = Find all occurrences of current search.

    • COMMAND+r = Find file symbol/function.

    • COMMAND+SHIFT+f = Project-wide search. Within the search panel, the following is also possible:

      • COMMAND+OPTION+r = Toggle regular expression search.

      • COMMAND+OPTION+c = Toggle case sensitive search.

      • COMMAND+OPTION+w = Toggle whole word search.

    • COMMAND+OPTION+r = File find and replace.

    • COMMAND+OPTION+g = Find all matching occurrences of what is under current cursor position.

  • Movement

    • CONTROL+OPTION+<arrow up/down key> = Scroll up/down by one line.

    • CONTROL+l = Scroll to selection.

    • CONTROL+<left arrow> = Move one word left.

    • CONTROL+<right arrow> = Move one word right.

    • COMMAND+<left arrow> = Move to beginning of line.

    • COMMAND+<right arrow> = Move to end of line.

  • Selection

    • COMMAND+SHIFT+<left arrow> = Move to beginning of line and select everything in between.

    • COMMAND+SHIFT+<right arrow> = Move to end of line and select everything in between.

    • CONTROL+SHIFT+m = Expand selection to brackets.

    • CONTROL+SHIFT+a = Expand selection to tag.

    • COMMAND+SHIFT+j = Expand selection to indentation.

    • COMMAND+l = Expand selection to current line.

    • COMMAND+SHIFT+SPACE = Expand selection to scope.

  • Multiple Cursor

    • COMMAND+click = Adds an additional cursor where clicked.

    • OPTION+click+drag = Adds additional cursors from where clicked and dragged to.

    • CONTROL+SHIFT+<arrow up> = Select previous line.

    • CONTROL+SHIFT+<arrow down> = Select next line.

    • COMMAND+SHIFT+l = Create multiple cursors for each line of selection.

  • Editing

    • COMMAND+CONTROL+f = Toggle full screen mode.

    • COMMAND+CONTROL+SHIFT+f = Toggle distraction free writing.

    • COMMAND+u = Soft undo.

    • COMMAND+SHIFT+u = Soft redo.

    • COMMAND+z = Hard undo.

    • COMMAND+SHIFT+z = Hard redo.

    • COMMAND+OPTION+. = Close tag.

    • COMMAND+ENTER = Insert and indent new line below cursor.

    • COMMAND+SHIFT+ENTER = Insert and indent new line above cursor.

    • COMMAND+DELETE = Delete from cursor to beginning of line.

    • COMMAND+k, COMMAND+k = Delete from cursor to end of line.

    • COMMAND+SHIFT+d = Duplicate line.

    • CONTROL+SHIFT+k = Delete line.

    • COMMAND+d = Select word (continue to select next match).

    • COMMAND+k, COMMAND+d = Skip selection of next matching word.

    • CONTROL+DELETE = Delete word before cursor.

    • CONTROL+BACKSPACE = Delete word after cursor.

    • COMMAND+OPTION+q = Wrap paragraph at ruler.

    • COMMAND+j = Join together whatever is selected.

    • COMMAND+[ = Indent selection left.

    • COMMAND+] = Indent selection right.

    • COMMAND+\ = Reindent current selection.

    • COMMAND+OPTION+[ = Fold code for current scope.

    • COMMAND+OPTION+] = Expand folded code for current scope.

    • COMMAND+k, COMMAND+1 = Fold all code.

    • COMMAND+k, COMMAND+j = Unfold all code.

    • COMMAND+k, COMMAND+u = Convert to uppercase text.

    • COMMAND+k, COMMAND+l = Convert to lowercase text.

    • COMMAND+/ = Toggle comment line.

    • COMMAND+OPTION+/ = Toggle comment block.

    • FN+F5 = Alpha-sort (case sensitive) selection (or multiple selection).

  • Bookmarks

    • COMMAND+FN+F2 = Toggle bookmark.

    • SHIFT+FN+F2 = Goto previous bookmark.

    • FN+F2 = Goto next bookmark.

    • COMMAND+SHIFT+FN+F2 = Clear bookmarks.

  • Clipboard

    • COMMAND+SHIFT+c = Copy current file path.

    • COMMAND+v = Paste and indent.

    • COMMAND+SHIFT+v = Paste.

  • Multiple Screens/Groups

    • OPTION+COMMAND+<number> = Split into <number> screens.

    • CONTROL+SHIFT+<number> = Move file to screen <number>.

    • CONTROL+<number> = Move cursor to screen <number>.

  • Tools

    • FN+F6 = Spell check.

    • CONTROL+~ = Open command line.

    • COMMAND+CONTROL+x = Runs auto-CSS prefixer.

  • Extensions

    • COMMAND+CONTROL+r = Reveal current file in sidebar.

    • CONTROL+SHIFT+' = Toggle between single and double quotes.

    • CONTROL+↑ = Adjust CSS value up one whole number.

    • CONTROL+↓ = Adjust CSS value down one whole number.

    • OPTION+↑ = Adjust CSS value up one decimal number.

    • OPTION+↓ = Adjust CSS value down one decimal number.

Debugging

To open and close the console:

  1. Type CONTROL+<backtick> to open console.

  2. Type CONTROL+<backtick> to exit console.

To see what commands/key bindings are being fired:

  1. Enter sublime.log_commands(True) within the console to enable command logging.

  2. Right click, use menus, etc. to let a log of the actual commands being fired.

  3. Find the command you are looking for in the log and then use that command to build a key binding for.

  4. Enter sublime.log_commands(False) within the condole to disable command logging.

To see what files are being indexed:

  1. Ensure the index_files settings is set to true.

  2. Enter sublime.log_indexing(True) to enable.

  3. Watch the log for file activity.

  4. Enter sublime.log_indexing(False) to disable.

Development

To contribute, run:

git clone https://github.com/bkuhlmann/sublime_text_setup.git
cd sublime_text_setup

Versioning

Read Semantic Versioning for details. Briefly, it means:

  • Major (X.y.z) - Incremented for any backwards incompatible public API changes.

  • Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.

  • Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.

Code of Conduct

Read Code of Conduct for details.

Contributions

Read Contributions for details.

Community

Feel free to join the commmunity for discussions related to this project and much more.

License

Read License for details.

Changes

Read Changes for details.

Credits