Sublime Text
Fast and sophisticated text editor with powerful features.
Official WebsiteFeatures
Installation
brew install --cask sublime-textapt install sublime-textpacman -S sublime-textchoco install sublimetext4Why Use Sublime Text?
Sublime Text is a fast and sophisticated text editor that has been under development since 2008. As a pioneer of multi-cursor editing and command palette, it had a major influence on later editors.
Lightning Fast
Instant startup as a native application. Opens large files with ease.
Multi-Cursor
Edit multiple locations simultaneously. Powerful editing with select all instances, rectangular selection, etc.
Command Palette
Access almost all features from keyboard. The original command palette pioneer.
Package Control
Rich package ecosystem. Easy installation of language support, themes, and feature extensions.
Installation
# macOS (Homebrew)
brew install --cask sublime-text
# macOS (from official website)
# https://www.sublimetext.com/download
# Ubuntu/Debian
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/sublimehq-archive.gpg > /dev/null
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
# Fedora
sudo rpm -v --import https://download.sublimetext.com/sublimehq-rpm-pub.gpg
sudo dnf config-manager --add-repo https://download.sublimetext.com/rpm/stable/x86_64/sublime-text.repo
sudo dnf install sublime-text
# Arch Linux
sudo pacman -S sublime-text-4
# Windows (Chocolatey)
choco install sublimetext4
# Windows (Scoop)
scoop install sublime-text
# Enable CLI tool (macOS)
sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublBasic Operations
# Open a file
subl filename.txt
# Open directory (project)
subl .
subl ~/projects/myapp
# Open multiple files
subl file1.txt file2.txt
# Open in new window
subl -n filename.txt
# Add to existing window
subl -a filename.txt
# Jump to specific line
subl filename.txt:10
# Wait mode (wait until file is closed)
subl -w filename.txt
# Compare diff
subl --compare file1.txt file2.txtCommon Keyboard Shortcuts
File Navigation
| Key (macOS) | Key (Windows/Linux) | Description |
|---|---|---|
Cmd+P | Ctrl+P | Goto Anything (file/symbol search) |
Cmd+Shift+P | Ctrl+Shift+P | Command Palette |
Cmd+R | Ctrl+R | Go to symbol (@) |
Cmd+G | Ctrl+G | Go to line (:) |
Cmd+K, Cmd+B | Ctrl+K, Ctrl+B | Toggle sidebar |
Cmd+` | Ctrl+` | Open console |
Multi-Cursor & Selection
| Key (macOS) | Key (Windows/Linux) | Description |
|---|---|---|
Cmd+D | Ctrl+D | Add next word to selection |
Cmd+Ctrl+G | Alt+F3 | Select all matching words |
Cmd+L | Ctrl+L | Select line (expand on repeat) |
Cmd+Shift+L | Ctrl+Shift+L | Split selection to lines (cursor at end) |
Cmd+Click | Ctrl+Click | Add cursor |
Ctrl+Shift+Up/Down | Ctrl+Alt+Up/Down | Add cursor above/below |
Cmd+Shift+Space | Ctrl+Shift+Space | Expand scope selection |
Editing
| Key (macOS) | Key (Windows/Linux) | Description |
|---|---|---|
Cmd+Shift+D | Ctrl+Shift+D | Duplicate line |
Cmd+Shift+K | Ctrl+Shift+K | Delete line |
Cmd+J | Ctrl+J | Join line |
Cmd+/ | Ctrl+/ | Toggle comment |
Cmd+Ctrl+Up/Down | Ctrl+Shift+Up/Down | Move line up/down |
Cmd+] / Cmd+[ | Ctrl+] / Ctrl+[ | Indent / Unindent |
Cmd+Enter | Ctrl+Enter | Insert new line below |
Cmd+Shift+Enter | Ctrl+Shift+Enter | Insert new line above |
Search & Replace
| Key (macOS) | Key (Windows/Linux) | Description |
|---|---|---|
Cmd+F | Ctrl+F | Find |
Cmd+H | Ctrl+H | Replace |
Cmd+Shift+F | Ctrl+Shift+F | Find in project |
Cmd+E | Ctrl+E | Use selection for find |
Package Control
Package Control is a package manager for Sublime Text. Thousands of packages are available.
Installing Package Control
# Install from console
1. Open console with Ctrl+` (or Cmd+`)
2. Paste the code below and press Enter
import urllib.request,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
# Restart Sublime Text after installationManaging Packages
# Install package
1. Open command palette with Cmd+Shift+P (or Ctrl+Shift+P)
2. Type "Package Control: Install Package"
3. Search for package name and press Enter
# Remove package
1. Open command palette
2. Type "Package Control: Remove Package"
3. Select package to remove
# Update packages
"Package Control: Upgrade Package" or
"Package Control: Upgrade/Overwrite All Packages"
# Popular packages
- Emmet : HTML/CSS expansion
- SublimeLinter : Linter framework
- LSP : Language Server Protocol
- A File Icon : Sidebar icons
- Material Theme : Material Design theme
- GitGutter : Git diff display
- BracketHighlighter : Bracket highlighting
- Terminus : Integrated terminal
- SideBarEnhancements: Sidebar extensions
- All Autocomplete : Completion from all filesConfiguration File
Sublime Text settings are written in JSON. Open with Preferences > Settings.
{
// Font
"font_face": "JetBrains Mono",
"font_size": 14,
// Color scheme
"color_scheme": "Packages/Color Scheme - Default/Monokai.sublime-color-scheme",
"theme": "Default Dark.sublime-theme",
// Tab settings
"tab_size": 2,
"translate_tabs_to_spaces": true,
"detect_indentation": true,
// Line numbers
"line_numbers": true,
"relative_line_numbers": false,
// Minimap
"draw_minimap_border": true,
"always_show_minimap_viewport": true,
// Cursor
"caret_style": "smooth",
"caret_extra_width": 2,
// Word wrap
"word_wrap": false,
"wrap_width": 120,
// Whitespace
"draw_white_space": ["selection"],
"trim_trailing_white_space_on_save": true,
"ensure_newline_at_eof_on_save": true,
// Sidebar
"show_definitions": true,
"preview_on_click": true,
// Auto save
"save_on_focus_lost": true,
// Auto pair
"auto_match_enabled": true,
// Scroll
"scroll_past_end": true,
"scroll_speed": 5.0,
// Format
"default_line_ending": "unix",
// Exclude files
"folder_exclude_patterns": [
".git",
"node_modules",
"__pycache__",
".cache"
],
"file_exclude_patterns": [
"*.pyc",
".DS_Store",
"*.lock"
],
// Highlighting
"highlight_line": true,
"highlight_modified_tabs": true,
// Indent guide
"indent_guide_options": ["draw_active"],
// Auto complete
"auto_complete_delay": 50,
"auto_complete_commit_on_tab": true
}Keymap Configuration
Customize keymaps with Preferences > Key Bindings.
[
// Save
{ "keys": ["ctrl+s"], "command": "save" },
// Duplicate line (VS Code style)
{ "keys": ["ctrl+shift+d"], "command": "duplicate_line" },
// Move line up/down
{ "keys": ["alt+up"], "command": "swap_line_up" },
{ "keys": ["alt+down"], "command": "swap_line_down" },
// Multi-cursor
{ "keys": ["ctrl+alt+up"], "command": "select_lines", "args": {"forward": false} },
{ "keys": ["ctrl+alt+down"], "command": "select_lines", "args": {"forward": true} },
// Toggle sidebar
{ "keys": ["ctrl+b"], "command": "toggle_side_bar" },
// Terminal (with Terminus package)
{ "keys": ["ctrl+`"], "command": "toggle_terminus_panel" },
// Go to definition
{ "keys": ["f12"], "command": "goto_definition" },
{ "keys": ["ctrl+click"], "command": "goto_definition" },
// Jump back
{ "keys": ["ctrl+-"], "command": "jump_back" },
{ "keys": ["ctrl+shift+-"], "command": "jump_forward" }
]Vintage Mode (Vim Keybindings)
Sublime Text has built-in Vintage Mode providing Vim keybindings.
# Enable Vintage Mode
# Add to Preferences.sublime-settings
{
// Remove Vintage from ignored_packages
"ignored_packages": [
// Remove "Vintage"
],
// Start Vintage mode in command mode
"vintage_start_in_command_mode": true,
// Ctrl+[ acts like Escape
"vintage_ctrl_keys": true
}
# For more powerful Vim emulation
# Install NeoVintageous package
# Package Control: Install Package → NeoVintageousLSP (Language Server Protocol)
Installing the LSP package provides language support similar to VS Code.
# Install LSP package
1. Package Control: Install Package
2. Search and install "LSP"
# Install language servers
# TypeScript/JavaScript
Package Control: Install Package → LSP-typescript
# Python
Package Control: Install Package → LSP-pyright
# or
pip install python-lsp-server
# Rust
Package Control: Install Package → LSP-rust-analyzer
# Go
Package Control: Install Package → LSP-gopls
# LSP Configuration
# Preferences > Package Settings > LSP > Settings
{
"show_diagnostics_panel_on_save": 0,
"lsp_format_on_save": true,
"clients": {
"pyright": {
"enabled": true
},
"typescript-language-server": {
"enabled": true
}
}
}
# LSP Commands
- LSP: Goto Definition
- LSP: Find References
- LSP: Rename
- LSP: Code Action
- LSP: Format DocumentTips
- •Use
Cmd+Pfor Goto Anything.@for symbols,:for lines,#for word search. - •Use
Cmd+Dto select matching words sequentially.Cmd+K, Cmd+Dto skip. - •Rectangular selection with
Option+drag(macOS) orShift+right-click. - •Use
Cmd+Shift+Lto place cursors at end of each selected line. Great for batch editing. - •Create project files (.sublime-project) for project-specific settings.
- •Sublime Text is free to try but license purchase is recommended for continued use.
- •Enter focus mode with
Distraction Free Mode(Cmd+Ctrl+Shift+F).