Skip to content

Instantly share code, notes, and snippets.

@ghouston
Forked from sjwilliams/gist:3903157
Last active November 16, 2017 19:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save ghouston/4686573 to your computer and use it in GitHub Desktop.
Save ghouston/4686573 to your computer and use it in GitHub Desktop.

Sublime Text 2 – Useful Shortcuts (Mac OS X and Windows)

General

shift key
control key
option or alt key
command or apple key

⌘T go to file
⌘⌃P ctrl-alt-P switch project
⌘KB ctrl-KB toggle side bar
⌘⇧P ctrl-shift-P command prompt
⌃ ` ctrl-` python console
⌘⇧N ctrl-shift-N new window (useful for new project)
F11 full screen
shift-F11 distraction free mode
⌘= ctrl-= zoom in
⌘- ctrl— zoom out

Movement

⌘← go to beginning of line (conflicts with default Mission Control shortcut)
⌘→ go to end of line (conflicts with default Mission Control shortcut)
*⌃↑ ctrl-↑ scroll one line up
*⌃↓ ctrl-↓ scroll one line down
⌘↑ go to start of file
⌘↓ go to end of file
⌘R ctrl-R go to methods
⌃G ctrl-G go to line
⌃M ctrl-M jump to matching brackets

Editing

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

Vintage Mode

:w :w save file
j j up one line
k k down one line
h h one position right
l l one position left
e e end of word
⇧e E end of WORD
w w next word
⇧w W next WORD
alt-w next sub-word
|
alt-shift-w prev sub-word
b b previous word
⇧b B previous WORD
^b ctrl-b page up
^f ctrl-f page down
0 0 beginning of line
^ ^ frst non-whitespace character on the line
$ $ end of line
% % go to match
* * next with same indent level
⇧h H first line of screen
⇧m M middle of the screen
⇧l L bottom of the screen
⇧g G end of file
gg gg start of file
i i insert before cursor
⇧i I insert at the beginning of current line
a a append after cursor
⇧a A append to the end of the current line
o o insert on a new line below
⇧O O insert on a new line above
r r replace single char
s s substitute char
⇧s S substitute line
/ / find
n n find next
⇧n N find previous

XML/HTML

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

Find/Replace

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

Splits/Tabs

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

Bookmarks

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

Marks

⌘K space ctrl-k-space set mark // ⌘K; for me
⌘KW ctrl-kw delete from cursor to mark
⌘KA ctrl-ka select from cursor to mark
⌘KG ctrl-kg clear mark
ctrl-ky yank and insert

Sublime Text 2 Ruby Tests

⌘⇧R run single ruby test
⌘⇧T run all ruby tests from current file
⌘⇧E run last ruby test
⌘⇧X test panel (hit esc to hide it)
*ATL⇧V check RB, ERB file syntax
⌘. switch between code and test (single view)
*⌘CTRL. switch between code and test (split view)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment