Introduction to Sublime Text Keyboard Shortcuts
Sublime Text is one of the most popular code editors among developers, and its true power lies in its keyboard shortcuts. While many users rely on menus and mouse clicks, mastering keyboard shortcuts can dramatically increase your productivity and make coding feel effortless. This guide covers everything you need to know about Sublime Text keyboard shortcuts, from the basics to advanced techniques.
What Are Sublime Text Keyboard Shortcuts?
Sublime Text keyboard shortcuts are key combinations that trigger specific commands within the editor without needing to navigate menus or use the mouse. They are built on top of Sublime Text's command palette system and can be customized to fit your workflow. Shortcuts exist for nearly every action โ from simple text editing to complex multi-cursor operations and project navigation.
Why Keyboard Shortcuts Matter
- Speed: Performing actions without leaving the keyboard saves seconds on every task, which adds up to hours over a week.
- Focus: Keeping your hands on the keyboard helps maintain concentration and flow state.
- Reproducibility: Shortcuts are deterministic โ the same keys always produce the same result.
- Customization: Sublime Text allows you to remap any shortcut to match your muscle memory from other editors.
Essential Editing Shortcuts
These are the shortcuts you will use most frequently. They cover basic text manipulation and cursor movement.
Basic Text Editing
// Windows/Linux
Ctrl + X // Cut line (no selection needed)
Ctrl + C // Copy line (no selection needed)
Ctrl + V // Paste
Ctrl + Z // Undo
Ctrl + Y // Redo
Ctrl + Shift + V // Paste and indent
Ctrl + K, Ctrl + K // Delete to end of line
Ctrl + K + Backspace // Delete to beginning of line
Ctrl + Enter // Insert line after
Ctrl + Shift + Enter // Insert line before
Ctrl + Shift + D // Duplicate line
Ctrl + J // Join lines
Ctrl + / // Toggle comment
Ctrl + Shift + / // Toggle block comment
// macOS
Cmd + X // Cut line
Cmd + C // Copy line
Cmd + V // Paste
Cmd + Z // Undo
Cmd + Shift + Z // Redo
Cmd + Enter // Insert line after
Cmd + Shift + D // Duplicate line
Cmd + J // Join lines
Cmd + / // Toggle comment
Cursor Movement
// Windows/Linux
Ctrl + Left // Move to previous word
Ctrl + Right // Move to next word
Home // Move to beginning of line
End // Move to end of line
Ctrl + Home // Move to beginning of file
Ctrl + End // Move to end of file
Ctrl + M // Jump to matching bracket
Ctrl + G // Go to line number
// macOS
Cmd + Left // Move to beginning of line
Cmd + Right // Move to end of line
Cmd + Up // Move to beginning of file
Cmd + Down // Move to end of file
Ctrl + M // Jump to matching bracket
Cmd + G // Go to line number
Selection Shortcuts
Sublime Text offers powerful selection tools that go far beyond simple highlighting. These shortcuts let you select text with precision and speed.
Text Selection
// Windows/Linux
Ctrl + A // Select all
Ctrl + L // Select entire line
Ctrl + D // Select next occurrence of current word
Ctrl + K, Ctrl + D // Skip current occurrence (with Ctrl+D chain)
Alt + F3 // Select all occurrences of current word
Ctrl + Shift + L // Split selection into lines
Ctrl + Shift + M // Expand selection to brackets
Ctrl + Shift + J // Expand selection to indentation
Ctrl + Shift + A // Expand selection to tag (HTML/XML)
// macOS
Cmd + A // Select all
Cmd + L // Select line
Cmd + D // Select next occurrence
Cmd + Ctrl + G // Select all occurrences
Cmd + Shift + L // Split selection into lines
Cmd + Shift + M // Expand to brackets
Cmd + Shift + A // Expand to tag
Multi-Cursor Editing
Multi-cursor editing is one of Sublime Text's signature features. It allows you to edit multiple locations simultaneously, which is invaluable for refactoring and bulk edits.
// Windows/Linux
Ctrl + Click // Add cursor at click location
Ctrl + Alt + Up // Add cursor above
Ctrl + Alt + Down // Add cursor below
Shift + Drag // Column selection (block select)
Middle Mouse Drag // Column selection
// macOS
Cmd + Click // Add cursor at click location
Cmd + Alt + Up // Add cursor above
Cmd + Alt + Down // Add cursor below
Shift + Drag // Column selection
Here is a practical example of using multi-cursor editing to convert a list of variables into an object:
// Original text โ place cursor on "name" and press Ctrl+D (or Cmd+D) repeatedly
const name = "John";
const age = 30;
const email = "john@example.com";
// After selecting all "const" keywords with Ctrl+D, replace with nothing,
// then use Ctrl+Shift+L to split selection into lines and add commas:
// Result:
name: "John",
age: 30,
email: "john@example.com",
Search and Replace
Sublime Text's search capabilities are robust and support regular expressions out of the box. Mastering these shortcuts will make finding and replacing text fast and precise.
Search Shortcuts
// Windows/Linux
Ctrl + F // Find in current file
Ctrl + H // Replace in current file
Ctrl + Shift + F // Find in files (project-wide search)
F3 // Find next
Shift + F3 // Find previous
Ctrl + F3 // Quick find next (uses current word)
Ctrl + Shift + F3 // Quick find previous
Alt + Enter // Select all matches (in find panel)
Ctrl + I // Incremental search
// macOS
Cmd + F // Find
Cmd + Alt + F // Replace
Cmd + Shift + F // Find in files
Cmd + G // Find next
Cmd + Shift + G // Find previous
Cmd + Ctrl + G // Select all matches
Cmd + I // Incremental search
Using Regular Expressions in Search
When the find panel is open, you can toggle regular expression mode. Here is a practical example of using regex to find and replace quoted strings:
// Find pattern (regex mode enabled):
"([^"]*)"
// Replace with:
'$1'
// This converts all double-quoted strings to single-quoted strings.
// Example before:
const greeting = "Hello, World!";
const name = "Sublime";
// Example after:
const greeting = 'Hello, World!';
const name = 'Sublime';
Navigation Shortcuts
Efficient navigation is critical when working with large files or multi-file projects. Sublime Text provides shortcuts for jumping between files, symbols, and project locations.
File and Project Navigation
// Windows/Linux
Ctrl + P // Quick open file (Goto Anything)
Ctrl + R // Goto symbol in current file
Ctrl + Shift + R // Goto symbol in project
Ctrl + ; // Goto word in current file
Ctrl + G // Goto line
Ctrl + Tab // Switch to next open file
Ctrl + Shift + Tab // Switch to previous open file
Ctrl + PageUp // Move to previous tab
Ctrl + PageDown // Move to next tab
Ctrl + W // Close current tab
Alt + 1-9 // Switch to tab by number
// macOS
Cmd + P // Quick open file
Cmd + R // Goto symbol
Cmd + Shift + R // Goto symbol in project
Cmd + G // Goto line
Cmd + Shift + T // Reopen last closed tab
Cmd + W // Close tab
Cmd + 1-9 // Switch to tab by number
Goto Anything Syntax
The Goto Anything panel (Ctrl+P or Cmd+P) supports special syntax for powerful navigation:
// File name fuzzy search
index
// File name + line number
index.js:42
// File name + symbol (using @)
index.js@render
// File name + search term (using #)
index.js#handleSubmit
// Just a symbol search (type @ first)
@render
// Just a line number (type : first)
:100
Command Palette
The Command Palette is the gateway to nearly every feature in Sublime Text. It provides fuzzy search access to all commands, snippets, and settings.
// Windows/Linux
Ctrl + Shift + P // Open Command Palette
// macOS
Cmd + Shift + P // Open Command Palette
Once open, you can type to search for commands. Some useful commands to try:
// Type these in the Command Palette:
"Set Syntax: JavaScript" // Change syntax highlighting
"Package Control: Install" // Install a new package
"Reindent Lines" // Fix indentation
"Sort Lines" // Sort selected lines alphabetically
"Toggle Minimap" // Show/hide the minimap
"Convert Case: Upper" // Convert to uppercase
"Convert Case: Lower" // Convert to lowercase
"Convert Case: Title" // Convert to title case
Split Windows and Layouts
Sublime Text supports split-screen layouts for viewing multiple files side by side. This is especially useful for comparing files or referencing documentation while coding.
// Windows/Linux
Alt + Shift + 1 // Single column layout
Alt + Shift + 2 // Two column layout
Alt + Shift + 3 // Three column layout
Alt + Shift + 4 // Four column layout
Alt + Shift + 5 // Grid layout (2x2)
Alt + Shift + 8 // Two row layout
Alt + Shift + 9 // Three row layout
Ctrl + K, Ctrl + Up // Move file to new group (above)
Ctrl + K, Ctrl + Down // Move file to new group (below)
Ctrl + K, Ctrl + Right // Move file to group (right)
Ctrl + K, Ctrl + Left // Move file to group (left)
// macOS
Cmd + Alt + 1 // Single column
Cmd + Alt + 2 // Two columns
Cmd + Alt + 3 // Three columns
Cmd + Alt + 5 // Grid layout
Cmd + Ctrl + Up // Move to group above
Cmd + Ctrl + Down // Move to group below
Customizing Keyboard Shortcuts
One of Sublime Text's greatest strengths is its customizability. You can remap any shortcut to suit your preferences. Custom keybindings are stored in JSON files and override the defaults.
How to Access Keybinding Settings
// Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P)
// Type: "Preferences: Key Bindings"
// This opens two files side by side:
// - Default (left): Read-only default keybindings
// - User (right): Your custom keybindings
// Example custom keybindings file (Default (Windows).sublime-keymap):
[
{
"keys": ["ctrl+alt+s"],
"command": "save_all"
},
{
"keys": ["ctrl+shift+r"],
"command": "reindent",
"args": {
"single_line": false
}
},
{
"keys": ["ctrl+d"],
"command": "run_macro_file",
"args": {
"file": "res://Packages/Default/Delete Line.sublime-macro"
}
},
{
"keys": ["ctrl+alt+l"],
"command": "reindent",
"args": {
"single_line": false
}
}
]
Context-Specific Keybindings
You can restrict keybindings to specific contexts, such as when the find panel is open or when editing a specific file type. This allows the same key combination to perform different actions depending on context.
// Example: Only active when editing Python files
{
"keys": ["ctrl+enter"],
"command": "run_existing_window_command",
"args": {
"id": "repl_python_run"
},
"context": [
{
"key": "selector",
"operator": "equal",
"operand": "source.python"
}
]
}
// Example: Only active when the find panel is open
{
"keys": ["enter"],
"command": "find_next",
"context": [
{
"key": "panel",
"operator": "equal",
"operand": "find"
}
]
}
// Example: Only active when a selection exists
{
"keys": ["ctrl+shift+up"],
"command": "swap_line_up",
"context": [
{
"key": "selection_empty",
"operator": "equal",
"operand": false
}
]
}
Advanced Shortcuts and Techniques
Bookmarks
Bookmarks let you mark specific lines and jump back to them quickly. This is useful when working on multiple sections of a large file.
// Windows/Linux
Ctrl + F2 // Toggle bookmark on current line
F2 // Next bookmark
Shift + F2 // Previous bookmark
Ctrl + Shift + F2 // Clear all bookmarks
Alt + F2 // Select all bookmarks
// macOS
Cmd + F2 // Toggle bookmark
F2 // Next bookmark
Shift + F2 // Previous bookmark
Cmd + Shift + F2 // Clear all bookmarks
Code Folding
// Windows/Linux
Ctrl + Shift + [ // Fold current selection
Ctrl + Shift + ] // Unfold current selection
Ctrl + K, Ctrl + 1 // Fold all at level 1
Ctrl + K, Ctrl + 2 // Fold all at level 2
Ctrl + K, Ctrl + J // Unfold all
Ctrl + K, Ctrl + T // Fold all HTML attributes
// macOS
Cmd + Alt + [ // Fold
Cmd + Alt + ] // Unfold
Cmd + K, Cmd + 1 // Fold level 1
Cmd + K, Cmd + J // Unfold all
Snippets and Macros
Snippets let you insert pre-defined code blocks with a trigger keyword and tab. Macros record a sequence of actions that you can replay.
// Creating a custom snippet:
// Command Palette > "Tools: New Snippet"
// Example snippet for a JavaScript function:
<snippet>
<content><![CDATA[
function ${1:functionName}(${2:args}) {
${3:// body}
}
]]></content>
<tabTrigger>fn</tabTrigger>
<scope>source.js</scope>
<description>JavaScript function</description>
</snippet>
// Usage: Type "fn" and press Tab in a .js file.
// Tab stops ($1, $2, $3) let you jump between editable positions with Tab.
Best Practices
Learn Shortcuts Gradually
Do not try to memorize every shortcut at once. Start with the essentials โ Ctrl+D, Ctrl+P, Ctrl+Shift+P, and Ctrl+F โ and add new ones as you encounter repetitive tasks. A good strategy is to identify actions you perform frequently with the mouse and find the keyboard equivalent.
Use the Command Palette as a Discovery Tool
When you are unsure of a shortcut, open the Command Palette (Ctrl+Shift+P) and search for the action. The palette shows the command name, and you can then look up or assign a shortcut. This turns the palette into both a tool and a learning resource.
Keep Custom Keybindings Organized
When customizing keybindings, add comments to explain why you changed them. Sublime Text's JSON keymap files do not natively support comments, but you can use a separate metadata key to document your changes:
[
{
"keys": ["ctrl+alt+s"],
"command": "save_all",
"_comment": "Save all open files at once"
},
{
"keys": ["ctrl+shift+r"],
"command": "reindent",
"args": {"single_line": false},
"_comment": "Reindent entire file with one shortcut"
}
]
Avoid Conflicting Keybindings
Before assigning a new shortcut, check the default keybindings file to ensure you are not overriding an important existing one. If you do override a default, make sure you have a replacement for the displaced command. You can search the default keymap file using Ctrl+F to verify.
Sync Keybindings Across Machines
If you use Sublime Text on multiple computers, consider syncing your User keybindings file through a cloud service or version control. The file is located at:
// Windows
%APPDATA%\Sublime Text\Packages\User\Default (Windows).sublime-keymap
// macOS
~/Library/Application Support/Sublime Text/Packages/User/Default (OSX).sublime-keymap
// Linux
~/.config/sublime-text/Packages/User/Default (Linux).sublime-keymap
Practice with Real Projects
The best way to internalize shortcuts is to use them in real work. Force yourself to use keyboard shortcuts even when the mouse feels faster initially. After a few days of deliberate practice, the shortcuts become muscle memory and your editing speed will increase noticeably.
Quick Reference Cheat Sheet
Here is a condensed reference of the most commonly used shortcuts for quick lookup:
=== EDITING ===
Ctrl+X / Cmd+X Cut line
Ctrl+Shift+D / Cmd+Shift+D Duplicate line
Ctrl+Enter / Cmd+Enter Insert line below
Ctrl+/ / Cmd+/ Toggle comment
Ctrl+J / Cmd+J Join lines
=== SELECTION ===
Ctrl+D / Cmd+D Select next occurrence
Alt+F3 / Cmd+Ctrl+G Select all occurrences
Ctrl+L / Cmd+L Select line
Ctrl+Shift+L / Cmd+Shift+L Split selection into lines
=== NAVIGATION ===
Ctrl+P / Cmd+P Goto Anything
Ctrl+R / Cmd+R Goto symbol
Ctrl+G / Cmd+G Goto line
Ctrl+Shift+P / Cmd+Shift+P Command Palette
=== SEARCH ===
Ctrl+F / Cmd+F Find
Ctrl+H / Cmd+Alt+F Replace
Ctrl+Shift+F / Cmd+Shift+F Find in files
=== VIEW ===
Alt+Shift+2 / Cmd+Alt+2 Two column layout
F11 Toggle full screen
Shift+F11 Toggle distraction-free mode
Conclusion
Mastering Sublime Text keyboard shortcuts transforms the editor from a simple text tool into a powerful extension of your thinking. By learning the essential editing, selection, navigation, and search shortcuts, then gradually incorporating advanced techniques like multi-cursor editing, bookmarks, and custom keybindings, you can dramatically reduce the time spent on mechanical tasks and focus more on writing great code. The key is consistent practice โ start with a handful of shortcuts, use them daily until they become second nature, and expand your repertoire over time. With the flexibility to customize every keybinding and the Command Palette as a built-in discovery tool, Sublime Text adapts to your workflow rather than forcing you to adapt to it.