Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
@lucifr

This comment has been minimized.

lucifr commented Sep 10, 2011

⌘⇧Z past and ident

This one seems not correct.

@lucasfais

This comment has been minimized.

Owner

lucasfais commented Sep 11, 2011

Fixed! Thanks.

@philstrong

This comment has been minimized.

philstrong commented Oct 7, 2011

Anyone know if there is find in file explorer?

@mdennisa

This comment has been minimized.

mdennisa commented Nov 9, 2011

@philstrong press ⌘P

@monobasic

This comment has been minimized.

monobasic commented Jan 17, 2012

another brilliant one:

  • select one or more lines
  • ctrl + cmd + cursor up/down to move around
@AdrienGiboire

This comment has been minimized.

AdrienGiboire commented Mar 2, 2012

The best thing to do stays to look at Default.sublime-keymap.

@hced

This comment has been minimized.

hced commented Apr 16, 2012

Does anyone know a shortcut to Go to Beginning and End of Line?

Seems a fairly simple operation but I can't seem to find a way to do it. (I'm using Mac and Cmd-Left/Right does nothing).

@monobasic

This comment has been minimized.

monobasic commented Apr 17, 2012

CMD - left/right works for me (?)

@philstrong

This comment has been minimized.

philstrong commented Apr 17, 2012

@jordanboston

This comment has been minimized.

jordanboston commented Apr 21, 2012

Helpful, Thanks.

@unRARed

This comment has been minimized.

unRARed commented Apr 24, 2012

If you enable Vintage Mode, you can move with the h,j,k, and l keys as well as use $,0 for moving to and from the beginning/ends of lines.

@khesayed

This comment has been minimized.

khesayed commented May 12, 2012

Excellent

@mrmartineau

This comment has been minimized.

mrmartineau commented May 17, 2012

Awesome! cheers lucas

@goldenmeanie

This comment has been minimized.

goldenmeanie commented May 29, 2012

Does anyone know a shortcut to Go to Beginning and End of Line?

I also wish ⌘-left and ⌘-right worked. ⌃-a and ⌃-e do work but are frustrating to this Mac user.

@goldenmeanie

This comment has been minimized.

goldenmeanie commented May 29, 2012

The ⌘-left and ⌘-right problem I was having was caused by a conflict with goto-CSS-declaration keybindings.

@r-is-u

This comment has been minimized.

r-is-u commented May 30, 2012

Thx for your help. Resolving the conflict in the goto-CSS bindings worked for me too!

@goldenmeanie

This comment has been minimized.

goldenmeanie commented May 30, 2012

@swenninger I ended up just deactivating the goto-CSS package. Did you get the two to play nicely together? goto-CSS seems useful!

@r-is-u

This comment has been minimized.

r-is-u commented May 30, 2012

@goldenmeanie I also just commented out what was standing in there. Don't know if i'll ever need it as I'm not really into web development (yet ^^).

@kahlil

This comment has been minimized.

kahlil commented Jul 2, 2012

@goldenmeanie you can use alt + arrow up or arrow down to jump to end or beginning of lines.

@goldenmeanie

This comment has been minimized.

goldenmeanie commented Jul 2, 2012

@kahlil Thanks! I some home missed that in my exploration. Will add that to the list of muscle-memory retraining I need to do.

@jpoirier

This comment has been minimized.

jpoirier commented Jul 4, 2012

small type for ⌘↩: "inter line after" should be "insert line after"

@toshimaru

This comment has been minimized.

toshimaru commented Jul 8, 2012

Just what I wanted! Thanks.

@timinator

This comment has been minimized.

timinator commented Jul 18, 2012

is there a command for toggling between current and previous tab?

@lolajl

This comment has been minimized.

lolajl commented Jul 27, 2012

This should be added: Select text, then Control-shift-W. I keep forgetting this every time I fire up Sublime Text 2.

@linuxaged

This comment has been minimized.

@jakebellacera

This comment has been minimized.

jakebellacera commented Aug 17, 2012

⌘+⇧+[ and ⌘+⇧+] will navigate through open tabs in a single pane. Actually, this is true across OSX globally.

@srikat

This comment has been minimized.

srikat commented Aug 21, 2012

More shortcuts to delete current line:

Cmd+X

Cmd+L, then delete.

@nicholasruunu

This comment has been minimized.

nicholasruunu commented Aug 22, 2012

Haha, @lolajl you bastard. :)

@egasimus

This comment has been minimized.

egasimus commented Aug 26, 2012

@lolajl you win

@allaire

This comment has been minimized.

allaire commented Aug 27, 2012

Here's a good screenshot of all the shortcuts, from the app cheatsheet. Perfect for print: http://d.pr/i/FFq8

@hzlzh

This comment has been minimized.

hzlzh commented Aug 27, 2012

⌘⇧G is also another useful shortcut.

@antoineguedes

This comment has been minimized.

antoineguedes commented Aug 29, 2012

Is there a shortcut that allow to display our css (or html, etc) inline?

@antoineguedes

This comment has been minimized.

antoineguedes commented Aug 29, 2012

Okay, I just found it.
It's: ⇧⌘L

@wamatt

This comment has been minimized.

wamatt commented Oct 1, 2012

Wow this is great. So strange that official documentation doesn't have a complete list of shortcuts.

@wamatt

This comment has been minimized.

wamatt commented Oct 1, 2012

'select content into brackets' should read 'Expand selection to brackets'

@cliftonlabrum

This comment has been minimized.

cliftonlabrum commented Oct 10, 2012

Select some text then hit:

⌃⇧W

...and begin typing. It will wrap the selected text in the HTML tag you are typing.

@chrishough

This comment has been minimized.

chrishough commented Oct 15, 2012

love this list, thank you for posting!

@zinkkrysty

This comment has been minimized.

zinkkrysty commented Oct 17, 2012

Multi-line editing:
⌘⇧L - split large selection into individual selected lines (multiple cursors)
⌘D - find next match of selection and go into editing mode for both (use multiple times - select more)

@shalins

This comment has been minimized.

shalins commented Nov 8, 2012

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

@jacaetevha

This comment has been minimized.

jacaetevha commented Nov 9, 2012

Anyone know how to use ⌘D for whole words only, or (better yet) to skip over an occurrence of the text?

Here's a contrived example. If I wanted to rename the curr variable starting from the point of declaration, ⌘D would select the variable, the "curr" of "current", the "curr" in "occurrences", etc.

curr = self.current
# ... other code, where curr may be used multiple times
occurrences = self.other_occurrences
#... other code, where curr may be used multiple times
@jacaetevha

This comment has been minimized.

jacaetevha commented Nov 9, 2012

Stupid me. ⌘D to select the occurrence, ⌘K ⌘D to skip that occurrence.

@GusGA

This comment has been minimized.

GusGA commented Nov 25, 2012

Someone knows what is the shortcut for "open in browser"?

@zachwolf

This comment has been minimized.

zachwolf commented Dec 13, 2012

Here's a tutorial on setting up open in browser.

@neotericneoteny

This comment has been minimized.

neotericneoteny commented Dec 16, 2012

There are several comments pertaining to what I'm about to add. It allows you to quickly perform an inline search for a string within the current file prior to performing a refactor via ⌘D and ⌘K.

⌘I Incremental Find (It's a capital letter "I")

To close the search window, instead of pressing esc (which will abort your search), press the return key once you've typed the desired string and then proceed with your multi-cursor cherry picking routine. I hope it helps!

@ichord

This comment has been minimized.

ichord commented Jan 6, 2013

| ⌘⇧J | select the method block |

@mkstix6

This comment has been minimized.

mkstix6 commented Jan 19, 2013

At work on Windows i can use Ctrl + Alt + (up/down) to multiple cursor select lines above and below, it's quite quick and useful . Can't seem to find it on Mac :-/, i know it must be here somewhere. Anyone know?

@rosaguns

This comment has been minimized.

rosaguns commented Jan 23, 2013

Let's say I have mistakenly edited a short cut. Any way that I can re edit it?

@bradstemke

This comment has been minimized.

bradstemke commented Feb 26, 2013

For quick switching between tabs I have been using the shortcut CMD+ALT+L/R Arrow Keys, and have enjoyed that more than the CMD+(1,2,3) style shortcut. Could be a good addition to this list, which has been super helpful for me!

@rahilsondhi

This comment has been minimized.

rahilsondhi commented Mar 5, 2013

How do I get command+enter to insert line after?

{ "keys": ["command+enter"], "command": "insert_line_after" } is not working

EDIT Got it working like this { "keys": ["command+enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line.sublime-macro"}, "caption": "Insert Line After" }

@larsvegas

This comment has been minimized.

larsvegas commented Mar 5, 2013

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

@svilenkov

This comment has been minimized.

svilenkov commented Apr 24, 2013

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

@mikeerickson

This comment has been minimized.

mikeerickson commented May 31, 2013

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

@irosenb

This comment has been minimized.

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

This comment has been minimized.

daniroyo commented Jul 1, 2013

Someone know how to move lines at editor like PC?

@gzfrancisco

This comment has been minimized.

gzfrancisco commented Aug 23, 2013

move the line up ^⌘↑

@thejtate

This comment has been minimized.

thejtate commented Sep 11, 2013

Thanks for the list! Very handy

@eckdanny

This comment has been minimized.

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

This comment has been minimized.

drn8 commented Oct 15, 2013

⌘⌥ / (block comment) works for you?

@hparra

This comment has been minimized.

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

This comment has been minimized.

wellrocha commented Nov 12, 2013

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

This comment has been minimized.

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

This comment has been minimized.

RandyBooth commented Dec 5, 2013

@kahlil Thanks for that shortcut!

@veenified

This comment has been minimized.

veenified commented Jan 20, 2014

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.

@misalabs

This comment has been minimized.

misalabs commented Feb 13, 2014

A lot of combinations :0

@wspurgin

This comment has been minimized.

wspurgin commented Apr 29, 2014

👍

@anandsunku

This comment has been minimized.

anandsunku commented May 4, 2014

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

This comment has been minimized.

Krucamper commented May 21, 2014

Many thanks.

@joshbedo

This comment has been minimized.

joshbedo commented Jun 12, 2014

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

This comment has been minimized.

2hu12 commented Jun 18, 2014

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

@lookshinji

This comment has been minimized.

lookshinji commented Sep 19, 2014

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?

@ghost

This comment has been minimized.

ghost commented Jan 15, 2015

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

@magonzz

This comment has been minimized.

magonzz commented Feb 6, 2015

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

This comment has been minimized.

alialavia commented Sep 4, 2015

Any shortcuts for deleting matching brackets?

@liyocee

This comment has been minimized.

liyocee commented Feb 19, 2016

⌘+w closes current tab for me.

@cortesben

This comment has been minimized.

cortesben commented Jul 12, 2016

Nice I will be using this! Thanks!

@fabriziobertoglio1987

This comment has been minimized.

fabriziobertoglio1987 commented Feb 10, 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

@jasperf

This comment has been minimized.

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

This comment has been minimized.

g-liu commented Jun 26, 2017

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

@shalins Command + Control + G

@prasdeva

This comment has been minimized.

prasdeva commented Aug 11, 2017

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