Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
Ctrl+⇧+↩ insert line before
Ctrl+⇧+↑ move line (or selection) up
Ctrl+L select line (repeat to select next lines)
Ctrl+D select word (repeat select others occurrences in context for multiple editing)
Ctrl+M jump to closing bracket for current code, repeat to jump to opening bracket
Ctrl+⇧+M select all contents of the current brackets (curly brackets, square brackets, parentheses)
Ctrl+KK delete from cursor to end of line
Ctrl+K+⌫ delete from cursor to start of line
Ctrl+] indent current line(s)
Ctrl+[ un-indent current line(s)
Ctrl+⇧+D duplicate line(s)
Ctrl+J join line below to the end of the current line
Ctrl+ / comment/un-comment current line
Ctrl+⇧+/ block comment current selection
Ctrl+Y redo, or repeat last keyboard shortcut command
Ctrl+⇧+V paste and indent correctly
Ctrl+Space select next auto-complete suggestion
Ctrl+U soft undo (somehow undoes your movements; it jumps to your last change before undoing it when you repeat this command)

Navigation/Goto Anywhere

Ctrl+P quick-open files by name in your project (doesn’t seem to need an actual project set up, it just searches in the directories around the currently-opened file
Ctrl+R goto symbol (functions and classes) in the file. Same as Ctrl+P, then type @
Ctrl+; goto word in current file. Same as Ctrl+P, then type #
Ctrl+G goto line in current file. Same as Ctrl+P, then type :

General

Ctrl+⇧+P command prompt
Ctrl+KB toggle side bar

Find/Replace

Ctrl+F find
Ctrl+H replace
Ctrl+⇧+F find in files

Tabs

Ctrl+⇧+t open last closed tab (just like in your browser)
Ctrl+PgDn cycle down through open tabs, cycle up with Ctrl+PgUp
Ctrl+⇆ cycle through last tabs (repeat to go back further in history)

Split window

Alt+⇧+2 split into two columns
Alt+⇧+1 revert to single column
Alt+⇧+5 grid (4 groups)
Ctrl+[1,2,3,4] jump to “group” (pane)
Ctrl+⇧+[1,2,3,4] move file to specified group

Bookmarks

Ctrl+F2 toggle bookmark
F2 next bookmark
⇧+F2 previous bookmark
Ctrl+⇧+F2 clear bookmarks

Text manipulation

Ctrl+KU upper case
Ctrl+KL lower case

Leimi commented Feb 22, 2012

Ctrl+C, Ctrl+X and Ctrl+V let you copy/cut/paste lines if you don't select anything. So, Ctrl+X doesn't "delete" a line, it cuts it. To delete a line, the default shortcut is Ctrl+Shift+K :)

Highlighting a bunch of lines then hitting Cmd (Ctrl?) +Shift+L gives you multi-cursors on each line. I do that, followed by Cmd + Right arrow (End?) to get easily get a cursor at the end of a series of lines to simultaneously type something after each.

@ghost
Owner

ghost commented Feb 23, 2012

@Leimi I was only slowly beginning to understand that. I've updated the reference for Ctrl+C and Ctrl+X.

@ghost
Owner

ghost commented Feb 23, 2012

@losvedir I've figured out that it's Ctrl+L repeated, followed by Ctrl+⇧+L, then finally to get to the end. Now you have the cursor at the end of multiple lines. Thanks for sharing!

Ctrl+Shift+J expand the selection to the indentation level of the current line. So if you want to select a block of code with the same indentation it's really useful.

A few written about in more detail: http://whiletruecode.com/post/7-handy-text-manipulation-tricks-sublime-text-2

Feels like someone should make a cheatsheet for these. It'd be interesting to explore a visual layout like ted naleid's vim movements

shabith commented Oct 14, 2012

Alt + F3 select all occurrences of current word for multiple editing. Very useful.

Useful information...
thank you... :)

lety4ent commented Feb 6, 2013

Very useful information, however ... could you modify the commands in order to be more specific about if it's a Ctrl or Cmd key ? Well, that could be great for iOS users.

Cool !

Thanks .
Very useful .

darxsys commented Apr 2, 2013

Thanks!

tuvokki commented Apr 10, 2013

For some serious concentration (though only on one screen); via the View menu. Select “Enter Distraction Free Mode,” or press shift + F11 (or use the Mac keyboard shortcut, Control + Shift + Command + F).

bendman commented Apr 10, 2013

The one that makes Ctrl+D (most common multi-cursor) so useful: Ctrl+K, Ctrl+D. Hitting Ctrl+K before hitting Ctrl+D allows you to skip to the next word, so you can be picky about what gets a cursor.

One note about multi-cursor is that it's case sensitive according to the current state of the Find tool. Open the find tool and set it to case sensitive if you want multi-cursor to be case sensitive.

These are definitely useful. Thought losvedir had the solution, but does anyone know the shortcut for slicing through the code? On notepad++ it was alt + vertical mouse drag, and it's the only thing I miss about that program.

That was very helpful! Thank u :)

EvanHahn commented Jun 3, 2013

I think Ctrl+KK should be Ctrl+K.

witsu commented Jun 5, 2013

Thank you

enlacee commented Jun 5, 2013

good !!

tmhrtwg commented Jul 3, 2013

Nice list, thanks!

Taiger commented Jul 3, 2013

To slice through the code hold down the middle mouse button for Windoz/Linux.

Also http://www.sublimetext.com/docs/2/column_selection.html is very useful (shift+RMB on Win/Linux or Middle Mouse Button or Ctrl + Shift + Up/Down )

Defenitivly Ctrl+⇧+t made my day, thank you!

Ctrl+` : To open console

pjc commented Aug 18, 2013

Two questions:

  1. How do I switch between columns in Textmate? ctrl + tabonly switches between tabs in the same column.
  2. How do I 'exit' a multiple cursor like you get from cmd + shift + l or cmd + d?

ntrp commented Sep 21, 2013

  1. ctrl + groupnumber -> ctrl + tab or ctrl + pgdown
  2. escape

what is CTRL+KU?

@xiaodaigh Ctrl + KU - pressed as Ctrl + K immediately followed by U - turns the text to uppercase. Similarly Ctrl + KL turns to lowercase.

ctrl + } increases font-size
ctrl + | decreases font-size

how could i go to end of a block or highlight it? if i keep the cursor at do (or some where on the line, would like to jump or highlight the end of the block.

do

end

@srinivas-singanamalla just use the end key on your keyboard, to highlight: shift + end

What key is ⇧? I've never seen that before.

and save all shortcut

@poisonrain ⇧ its the shift key

hanvid commented Mar 19, 2014

Thanks a lot for these shortcuts. Really useful!

Ctrl/Cmd+Shift V is great. How many times I've spoken ill words to Sublime after pasting (Ctrl/Cmd+V) some nicely indented code and have it completely balled up. Now I know it was a PEBKAC error.

Brilliant !!! Thank you.

the coolest shortcut EVER is 'ctrl' + 'shift' + 'w' with a block of code selected. This wraps the code in a tag. By default is a p tag in HTML files, not sure what it would be in others languages. But you can change the opening and closing tag just by typing... Very helpful if you want to encapsulate a block of code in a div for example.

I don't know if this is common sense but: If you don't select anything, Ctrl + Shift + D duplicates the line to the next one, and if you select something it duplicates the content at the end of the selection.

@ghost

ghost commented Jul 14, 2014

How to increase text size on MAC

Great!

xkeshav commented Jul 30, 2014

Alt + . => Close HTML tag

If I go too far with Ctrl+D how to I go a step back or how to go backward?

xala3pa commented Nov 15, 2014

Great!! Thanks

Thanks!
Really helpful.

How can I stop a program that I started running from sublime(CTRL+ b) without going to terminal?

Really Helpful
Thanks!

daao87 commented Mar 4, 2015

Is it possible to add or remove spaces to a block of selected text? I mean, like when pressing tab for a selection indents all the block at once, I would like the same behavior but with spaces instead. Thanks!!

Sometimes I want replacements only in the selected text. How do I add the "in selection" command to a key press. I'm unable to figure out the command for that.

what key is ↩???

@wenqinruan ↩ is the enter or return key

dimpu commented Sep 1, 2015

Thanks

anyone let me know multi select shortcut for sublime 3? I have used ctrl + shift + l in sublime test 2, seems it is not working in 3. I am used to ctrl + shft + l, but the command ctrl + x + ⇧ for sublime 3 it's not very user friendly.

how to create numered list or bulleted list !

niyaz000 commented May 8, 2016

Nice one.....

Thanks

Thanx

Thanks

lajtmaN commented Dec 16, 2016

ALT + Enter - selects all matches of the current search. This is so usefull!! Search for regex, and create a curser everywhere the regex is fulfilled for an example.

zural commented Jan 4, 2017

Very Usefull Shortcuts...
Thanks.

dvolium commented Jan 14, 2017

Sublime 2 Question:
How to expand/collapse (min/max size) Layout Areas by hotkeys?

Sometime I use 2 row-Layout for configs below and main code above.
But dragging areas border by mouse cursor is uncomfortably.

Ctrl + N =New file in new tab
Ctrl + O =Open file in new tab
Ctrl + S =Save
Ctrl + Shift + S =Save as
Ctrl + Shift + N =New file in new window
Ctrl + W =Exit active/current file
Ctrl + Shift + W =Close current window

tovbaev commented Mar 14, 2017

how to unquote the selection inside brackets: array["hello world"]?
Quoting the selection is missing in the list!
Ctrl+Shift+M => select the words in brackets, then
Shift+", or " => quote the selection

any shortcut key for node js code formatting ?

how to copy a line and paste it on the next line!

not Ctrl + C & Ctrl + V

// this is the first line!

become this

// this is the first line!
// this is the first line!

Shift+Ctrl+D Duplicate line(s)

Ctrl+⇧+D duplicate line(s)

Shift + Ctrl + D

https://www.shortcutfoo.com/app/dojos/sublime-text-3-win/cheatsheet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment