Skip to content

Instantly share code, notes, and snippets.

@lucasfais
Created September 9, 2011 18:46
Show Gist options
  • Save lucasfais/1207002 to your computer and use it in GitHub Desktop.
Save lucasfais/1207002 to your computer and use it in GitHub Desktop.
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
⌃ ` python console
⌘⇧N new window (useful for new project)

Editing

⌘L select line (repeat select next lines)
⌘D select word (repeat select others occurrences in context for multiple editing)
⌃⇧M select content into brackets
⌘⇧↩ insert line before
⌘↩ inter line after
⌃⇧K delete line
⌘KK delete from cursor to end of line
⌘K⌫ delete from cursor to start of line
⌘⇧D duplicate line(s)
⌘J join lines
⌘KU upper case
⌘KL lower case
⌘ / comment
⌘⌥ / block comment
⌘Y redo or repeat
⌘⇧V past and ident
⌃ space autocomplete (repeat to select next suggestion)
⌃M jump to matching brackets
⌘U soft undo (movement undo)
⌘⇧U soft redo (movement redo)

XML/HTML

⌘⇧A select content into tag
⌘⌥ . close tag

Find/Replace

⌘F find
⌘⌥F replace
⌘⌥G find next occurrence of current word
⌘⌃G select all occurrences of current word for multiple editing
⌘⇧F find in files

Splits/Tabs

⌘⌥1 single column
⌘⌥2 two columns
⌘⌥5 grid (4 groups)
⌃[1,2,3,4] focus group
⌃⇧[1,2,3,4] move file to group
⌘[1,2,3…] select tab

Bookmarks

⌘F2 toggle bookmark
F2 next bookmark
⇧F2 previous bookmark
⌘⇧F2 clear bookmarks

Marks

⌘K space set mark // ⌘K; for me
⌘KW delete from cursor to mark
⌘KA select from cursor to mark
⌘KG clear mark
@larsvegas
Copy link

⌘⇧T reopens a closed tab/file - chrome alike

@svilenkov
Copy link

Nice list, thanks. I've forked a PC version if anyone is interested https://gist.github.com/keeperhood/5452582

@mikeerickson
Copy link

There are SO MANY keyboard equivalents, I can never remember them all

@irosenb
Copy link

irosenb commented Jun 14, 2013

For tabs, you can also use ⌘⌥←→ to switch tabs left/right. Same goes for Chrome. I forked it if you're interested: https://gist.github.com/irosenb/5785324

@daniroyo
Copy link

daniroyo commented Jul 1, 2013

Someone know how to move lines at editor like PC?

@gzfrancisco
Copy link

move the line up ^⌘↑

@thejtate
Copy link

Thanks for the list! Very handy

@eckdanny
Copy link

eckdanny commented Oct 7, 2013

Not ST2 keyboard shortcut, but extremely handy: create symlink in your path to ST2 for quickly firing up the editor in 'project mode' with the desired directory provided as argument:

cd ~/bin && ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" subl

then use it like this:

cd ~/workspace/myProject && subl .    # opens current dir
subl ~/workspace/fooBar               # opens fooBar (dir or file)

I'd give credit if i could remember where i stole this from!

@drn8
Copy link

drn8 commented Oct 15, 2013

⌘⌥ / (block comment) works for you?

@hparra
Copy link

hparra commented Oct 22, 2013

Remember: on Mac you get some Emacs bindings for free on all Cocoa apps, including Sublime Text. Some of you may find binding your Capslock key to Ctrl easier on the pinky.

@wellrocha
Copy link

Nice.

If someone does not know the shortcuts:

⌥ Option
⌘ Command
⌃ Control
⌦ Delete
⌅ Enter
⇧ Shift
SP Spacebar
⇥ Tab

http://www.osxkeyboardshortcuts.com/keyboard-symbols.html

@edy
Copy link

edy commented Nov 30, 2013

To place multiple cursers easily on multiple lines at the same place:
hold (Option/Alt), click and drag your mouse

@RandyBooth
Copy link

@kahlil Thanks for that shortcut!

@veenified
Copy link

Is there a Windows version of this Gist? I am particularly interested in the shortcut for "select all occurrences of current word for multiple editing" on Windows.

@0xbepresent
Copy link

A lot of combinations :0

@wspurgin
Copy link

👍

@anandsunku
Copy link

i am not able to goto definition of a variable definition in c++ file, even the sublime text 3 shows only function definition when i press command+ shift + r. is there any way possible to get it ?

i ve become mad with sublime text, i love it but missing these few things is driving me mad.

@Krucamper
Copy link

Many thanks.

@joshbedo
Copy link

Is there a way to close the current tab? i know you can close the window but i don't see anything for closing the current tab you're in.

@2hu12
Copy link

2hu12 commented Jun 18, 2014

@joshbedo ⌃+w to close current tab. @mkstix6 you have found the answer?

@lookshinji
Copy link

Hey, anyone could help me?

I was used to sublime on windows, when i used ctrl+H for replace and i had an text highlighted, was automatically copied to find field. Now when I use cmd+option+f even if i have something highlighted the field shows empty or with last search. Can I have the same experience from windows with this? There is another shortcut?

Copy link

ghost commented Jan 15, 2015

Is there any short-cut key for finding word in whole project

@gitmikegonz684
Copy link

Does the commenting shortcut only work for certain programming languages? It works when I'm editing .java files but not .groovy. Any clue as to why?

@alialavia
Copy link

Any shortcuts for deleting matching brackets?

@liyocee
Copy link

liyocee commented Feb 19, 2016

⌘+w closes current tab for me.

@cortesben
Copy link

Nice I will be using this! Thanks!

@fabOnReact
Copy link

Hello Experts, I am searching for a Linux shortcut to move tabs in Sublime text, I do not mean switching tab but moving them.
Tab 1 is the first of 3 tabs and I want to move it as last. Thanks

@jasperf
Copy link

jasperf commented Apr 18, 2017

Hello Experts, I am searching for a Linux shortcut to move tabs in Sublime text, I do not mean switching tab but moving them.
Tab 1 is the first of 3 tabs and I want to move it as last. Thanks

would love to know this as well

@g-liu
Copy link

g-liu commented Jun 26, 2017

Does anyone know shortcut to find all of one word and delete it?

@shalins Command + Control + G

@prasdeva
Copy link

Having little experience with sublime Text, how do i quickly find a text with in a file ?

CMD + F will get me find but I need to copy + past search text into the search box. Surely there must be a quick way to get the selected text with in search box, like notepad++.

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