Skip to main content
โšก Calmops

Sublime Text: Complete Setup Guide, Shortcuts, and Plugins

Introduction

Sublime Text is a fast, lightweight code editor known for its speed, multi-cursor editing, and extensibility. While VS Code has become more popular, Sublime Text remains a favorite for its performance โ€” it opens instantly even with large files and never feels sluggish.

Installation

# macOS
brew install --cask sublime-text

# Ubuntu/Debian
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt update && sudo apt install sublime-text

# Windows
# Download from https://www.sublimetext.com/download

Essential Keyboard Shortcuts

Shortcut Action
Ctrl+P Go to file (fuzzy search)
Ctrl+P then :42 Go to line 42 in current file
Ctrl+P then @symbol Go to function/symbol
Ctrl+P then #keyword Search for keyword
Ctrl+G Go to line number
Ctrl+R Go to symbol/function
Ctrl+; Go to word in file
Ctrl+Shift+P Command palette

Editing

Shortcut Action
Ctrl+D Select next occurrence of word
Ctrl+K, Ctrl+D Skip current occurrence, select next
Alt+F3 Select all occurrences of word
Ctrl+Shift+L Split selection into lines
Ctrl+L Select entire line
Ctrl+Shift+K Delete line
Ctrl+Enter Insert line after
Ctrl+Shift+Enter Insert line before
Ctrl+Shift+โ†‘/โ†“ Move line up/down
Ctrl+/ Toggle line comment
Ctrl+Shift+/ Toggle block comment
Ctrl+] Indent
Ctrl+[ Unindent

Multi-Cursor Editing

Sublime Text’s killer feature โ€” edit multiple places simultaneously:

# Select multiple occurrences of a word:
1. Place cursor on a word
2. Ctrl+D to select next occurrence
3. Keep pressing Ctrl+D to add more
4. Type to replace all selected occurrences at once

# Select all occurrences at once:
Alt+F3

# Add cursor at each selected line:
Ctrl+Shift+L (after selecting multiple lines)

# Add cursor with mouse:
Ctrl+Click (add cursor at click position)
Ctrl+Shift+Click (add cursor and select to click)

Search and Replace

Shortcut Action
Ctrl+F Find in file
Ctrl+H Find and replace
Ctrl+Shift+F Find in all files
Ctrl+Shift+H Find and replace in all files
F3 Find next
Shift+F3 Find previous
Alt+Enter Select all matches (in Find bar)

Window Management

Shortcut Action
Ctrl+N New file
Ctrl+W Close tab
Ctrl+Shift+T Reopen closed tab
Ctrl+Tab Next tab
Ctrl+Shift+Tab Previous tab
Alt+Shift+1/2/3/4 Split layout (1/2/3/4 columns)
Ctrl+K, Ctrl+B Toggle sidebar
Ctrl+` Toggle console

Installing Package Control

Package Control is the plugin manager for Sublime Text. Install it first:

  1. Open the command palette: Ctrl+Shift+P
  2. Type “Install Package Control” and press Enter
  3. Wait for installation to complete

Or via the console (Ctrl+`):

import urllib.request,os,hashlib; h = '...'  # see sublimetext.com/docs/package_control

Essential Plugins

Install any plugin via: Ctrl+Shift+P โ†’ “Package Control: Install Package” โ†’ type plugin name

Emmet

HTML and CSS abbreviation expansion. Type a shorthand and press Tab to expand:

<!-- Type: div.container>ul.list>li.item*3>a{Item $} then Tab -->
<div class="container">
  <ul class="list">
    <li class="item"><a href="">Item 1</a></li>
    <li class="item"><a href="">Item 2</a></li>
    <li class="item"><a href="">Item 3</a></li>
  </ul>
</div>

<!-- Type: ! then Tab for HTML boilerplate -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
</body>
</html>

SublimeLinter

Framework for running linters inline. Install the framework, then language-specific linters:

SublimeLinter           # base framework
SublimeLinter-eslint    # JavaScript
SublimeLinter-rubocop   # Ruby
SublimeLinter-flake8    # Python
SublimeLinter-shellcheck # Shell scripts

GitGutter

Shows git diff indicators in the gutter (added/modified/deleted lines).

SideBarEnhancements

Adds right-click menu options to the sidebar: open in browser, copy path, duplicate, move, etc.

DocBlockr

Auto-generates documentation comment blocks. Type /** and press Enter above a function:

/**
 * [description]
 * @param  {[type]} name [description]
 * @return {[type]}      [description]
 */
function greet(name) {
    return `Hello, ${name}!`;
}

BracketHighlighter

Highlights matching brackets, parentheses, and tags.

A File Icon

Adds file type icons to the sidebar for visual file identification.

Terminus

Integrated terminal inside Sublime Text. Open with Ctrl+Alt+T.

LSP (Language Server Protocol)

Adds IDE-like features (autocomplete, go-to-definition, hover docs) via language servers:

LSP                    # base package
LSP-pyright            # Python
LSP-typescript         # TypeScript/JavaScript
LSP-solargraph         # Ruby
LSP-gopls              # Go

Configuration

Open user settings: Ctrl+Shift+P โ†’ “Preferences: Settings”

{
    "font_size": 14,
    "font_face": "JetBrains Mono",
    "tab_size": 2,
    "translate_tabs_to_spaces": true,
    "trim_trailing_white_space_on_save": true,
    "ensure_newline_at_eof_on_save": true,
    "rulers": [80, 120],
    "word_wrap": false,
    "highlight_line": true,
    "highlight_modified_tabs": true,
    "show_encoding": true,
    "show_line_endings": true,
    "auto_complete_delay": 50,
    "ignored_packages": []
}

Enabling Vim Mode (Vintage)

Sublime Text has a built-in Vim emulation mode called Vintage:

// Preferences โ†’ Settings โ€” remove "Vintage" from ignored_packages
{
    "font_size": 12,
    "ignored_packages": []  // remove "Vintage" from this list
}

After enabling, press Esc to enter command mode. Most Vim commands work.

Creating Snippets

Snippets let you insert boilerplate code with a keyword + Tab:

Tools โ†’ Developer โ†’ New Snippet

<snippet>
    <content><![CDATA[
def ${1:function_name}(${2:args}):
    """${3:Docstring.}"""
    ${4:pass}
]]></content>
    <tabTrigger>def</tabTrigger>
    <scope>source.python</scope>
    <description>Python function</description>
</snippet>

Save as ~/.config/sublime-text/Packages/User/python-function.sublime-snippet.

Build Systems

Run code directly from Sublime Text with Ctrl+B:

Tools โ†’ Build System โ†’ New Build System

{
    "cmd": ["python3", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python",
    "encoding": "utf-8"
}

Resources

Comments