public
Last active — forked from hileon/gist:1311735

Sublime Text 2 - Useful Shortcuts

  • Download Gist
gistfile1.textile
Textile

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

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.

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

@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

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

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

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 .

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).

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 :)

I think Ctrl+KK should be Ctrl+K.

Nice list, thanks!

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

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?

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

@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.

@PoisonRain ⇧ its the shift key

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.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.