Sublime Text keyboard shortcuts
Sublime Text is a fast code editor for Windows, macOS and Linux, known for Goto Anything and multiple selections. These are its default key bindings.
Most used Sublime Text keyboard shortcuts
The Sublime Text shortcuts worth learning first. The full list follows, grouped by task.
- Command paletteMacShiftCmdPWindowsCtrlShiftPLinuxCtrlShiftP
- Goto Anything (open a file)MacCmdPWindowsCtrlPLinuxCtrlP
- Go to a lineMacCtrlGWindowsCtrlGLinuxCtrlG
- Duplicate the lineMacShiftCmdDWindowsCtrlShiftDLinuxCtrlShiftD
- Delete the lineMacCtrlShiftKWindowsCtrlShiftKLinuxCtrlShiftK
- Comment or uncomment the lineMacCmd/WindowsCtrl/LinuxCtrl/
- Add the next match to the selectionMacCmdDWindowsCtrlDLinuxCtrlD
- FindMacCmdFWindowsCtrlFLinuxCtrlF
- Find in filesMacShiftCmdFWindowsCtrlShiftFLinuxCtrlShiftF
General
10 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Command palette | ShiftCmdP | CtrlShiftP | CtrlShiftP |
| Goto Anything (open a file) | CmdP | CtrlP | CtrlP |
| Go to a symbol in the file | CmdR | CtrlR | CtrlR |
| Go to a symbol in the project | ShiftCmdR | CtrlShiftR | CtrlShiftR |
| Go to a line | CtrlG | CtrlG | CtrlG |
| Show or hide the side bar | CmdK,CmdB | CtrlK,CtrlB | CtrlK,CtrlB |
| Full screen | CtrlCmdF | F11 | F11 |
| Distraction-free mode | CtrlShiftCmdF | ShiftF11 | ShiftF11 |
| Show or hide the console | Ctrl` | Ctrl` | Ctrl` |
| Build | CmdB | CtrlB | CtrlB |
Files and tabs
9 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| New file | CmdN | CtrlN | CtrlN |
| Save | CmdS | CtrlS | CtrlS |
| Save as | ShiftCmdS | CtrlShiftS | CtrlShiftS |
| Close the file | CmdW | CtrlW | CtrlW |
| Reopen the closed file | ShiftCmdT | CtrlShiftT | CtrlShiftT |
| Next tab | OptionCmd→ | CtrlPageDown | CtrlPageDown |
| Previous tab | OptionCmd← | CtrlPageUp | CtrlPageUp |
| Two-column layout | OptionCmd2 | AltShift2 | AltShift2 |
| Single-column layout | OptionCmd1 | AltShift1 | AltShift1 |
Editing
15 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Duplicate the line | ShiftCmdD | CtrlShiftD | CtrlShiftD |
| Delete the line | CtrlShiftK | CtrlShiftK | CtrlShiftK |
| Move the line up | CtrlCmd↑ | CtrlShift↑ | CtrlShift↑ |
| Move the line down | CtrlCmd↓ | CtrlShift↓ | CtrlShift↓ |
| Insert a line after | CmdEnter | CtrlEnter | CtrlEnter |
| Insert a line before | ShiftCmdEnter | CtrlShiftEnter | CtrlShiftEnter |
| Join lines | CmdJ | CtrlJ | CtrlJ |
| Comment or uncomment the line | Cmd/ | Ctrl/ | Ctrl/ |
| Block comment | OptionCmd/ | CtrlShift/ | CtrlShift/ |
| Indent | Cmd] | Ctrl] | Ctrl] |
| Unindent | Cmd[ | Ctrl[ | Ctrl[ |
| Jump to the matching bracket | CtrlM | CtrlM | CtrlM |
| Convert to upper case | CmdK,CmdU | CtrlK,CtrlU | CtrlK,CtrlU |
| Convert to lower case | CmdK,CmdL | CtrlK,CtrlL | CtrlK,CtrlL |
| Sort lines | F5 | F9 | F9 |
Selection
8 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Add the next match to the selection | CmdD | CtrlD | CtrlD |
| Skip this match and add the next | CmdK,CmdD | CtrlK,CtrlD | CtrlK,CtrlD |
| Select all matches | CtrlCmdG | AltF3 | AltF3 |
| Undo the last selection | CmdU | CtrlU | CtrlU |
| Select the line | CmdL | CtrlL | CtrlL |
| Split the selection into lines | ShiftCmdL | CtrlShiftL | CtrlShiftL |
| Expand the selection to brackets | CtrlShiftM | CtrlShiftM | CtrlShiftM |
| Add a cursor on the line below | CtrlShift↓ | CtrlAlt↓ | AltShift↓ |
Search
6 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Find | CmdF | CtrlF | CtrlF |
| Replace | OptionCmdF | CtrlH | CtrlH |
| Find next | CmdG | F3 | F3 |
| Find previous | ShiftCmdG | ShiftF3 | ShiftF3 |
| Find in files | ShiftCmdF | CtrlShiftF | CtrlShiftF |
| Go to definition | F12 | F12 | F12 |
Code folding
4 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Fold | OptionCmd[ | CtrlShift[ | CtrlShift[ |
| Unfold | OptionCmd] | CtrlShift] | CtrlShift] |
| Fold all | CmdK,Cmd1 | CtrlK,Ctrl1 | CtrlK,Ctrl1 |
| Unfold all | CmdK,CmdJ | CtrlK,CtrlJ | CtrlK,CtrlJ |
No shortcuts match. Try fewer words, the key names only, or search every app.
Show the key map: which keys Sublime Text uses mostDarker orange = used by more shortcuts
Sublime Text editing shortcuts: comment, delete, duplicate and move lines
- Block commentMacOptionCmd/WindowsCtrlShift/LinuxCtrlShift/
- Insert a line afterMacCmdEnterWindowsCtrlEnterLinuxCtrlEnter
- Insert a line beforeMacShiftCmdEnterWindowsCtrlShiftEnterLinuxCtrlShiftEnter
- Join linesMacCmdJWindowsCtrlJLinuxCtrlJ
- IndentMacCmd]WindowsCtrl]LinuxCtrl]
- UnindentMacCmd[WindowsCtrl[LinuxCtrl[
- Jump to the matching bracketMacCtrlMWindowsCtrlMLinuxCtrlM
- Convert to upper caseMacCmdK,CmdUWindowsCtrlK,CtrlULinuxCtrlK,CtrlU
- Convert to lower caseMacCmdK,CmdLWindowsCtrlK,CtrlLLinuxCtrlK,CtrlL
- Sort linesMacF5WindowsF9LinuxF9
- FoldMacOptionCmd[WindowsCtrlShift[LinuxCtrlShift[
- UnfoldMacOptionCmd]WindowsCtrlShift]LinuxCtrlShift]
- Fold allMacCmdK,Cmd1WindowsCtrlK,Ctrl1LinuxCtrlK,Ctrl1
- Unfold allMacCmdK,CmdJWindowsCtrlK,CtrlJLinuxCtrlK,CtrlJ
Multiple cursors and selection in Sublime Text
- Skip this match and add the nextMacCmdK,CmdDWindowsCtrlK,CtrlDLinuxCtrlK,CtrlD
- Select all matchesMacCtrlCmdGWindowsAltF3LinuxAltF3
- Undo the last selectionMacCmdUWindowsCtrlULinuxCtrlU
- Select the lineMacCmdLWindowsCtrlLLinuxCtrlL
- Split the selection into linesMacShiftCmdLWindowsCtrlShiftLLinuxCtrlShiftL
- Expand the selection to bracketsMacCtrlShiftMWindowsCtrlShiftMLinuxCtrlShiftM
- Add a cursor on the line belowMacCtrlShift↓WindowsCtrlAlt↓LinuxAltShift↓
Build, run and window shortcuts in Sublime Text
- BuildMacCmdBWindowsCtrlBLinuxCtrlB
- Full screenMacCtrlCmdFWindowsF11LinuxF11
- Distraction-free modeMacCtrlShiftCmdFWindowsShiftF11LinuxShiftF11
- Show or hide the consoleMacCtrl`WindowsCtrl`LinuxCtrl`
- Run a program
- Ctrl+B (Cmd+B on Mac) runs the current file with the build system for its language, such as Python; Tools > Build System picks another.
- Format JSON and expand HTML
- Sublime has no built-in formatter: install Pretty JSON through Package Control (Ctrl+Shift+P > Install Package), and Emmet for HTML abbreviations that expand with Tab.
Change keyboard shortcuts in Sublime Text
- Key bindings file
- Preferences > Key Bindings opens the defaults on the left and your own file on the right. Copy a line to the right, change its keys and save; your file overrides the defaults.
Sublime Text keyboard shortcuts: questions
- Why are Sublime Text keyboard shortcuts not working?
- A package can rebind keys: check the console (Ctrl+`) after typing sublime.log_input(True) and sublime.log_commands(True) to see what each key does. On Linux, the desktop may take Ctrl+Alt combinations first.
These are the default key bindings in Sublime Text 4 (Build 4200), as published by Sublime HQ. Shortcuts that need an extension, an add-in or a changed keymap are left out. Where two combinations do the same thing, both are shown.
Single-system lists: Sublime Text keyboard shortcuts for Mac, Sublime Text keyboard shortcuts for Windows, Sublime Text keyboard shortcuts for Linux.
Each shortcut has its own page with the keys for every system, related shortcuts and the same action in other apps. The printable cheat sheet fits the whole list on one or two pages.