Skip to content

Instantly share code, notes, and snippets.

@njoubert
Forked from lucasfais/gist:1207002
Last active October 12, 2015 17:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save njoubert/4062168 to your computer and use it in GitHub Desktop.
Save njoubert/4062168 to your computer and use it in GitHub Desktop.
Sublime Text 2 & 3 - Useful Shortcuts

Sublime Text 2 – Shortcuts

Here’s how I use sublime as efficiently as possible.

Modify your user keymap by adding these:

{ “keys”: [“super+h”], “command”: “find_under_expand” },

General

⌘P go to ANYTHING (my main shortcut)
⌘⇧N new window (useful for new project)
⌘⇧P command prompt
⌃ ` python console
⌘KB toggle side bar

Navigation (Absolutely Crucial Section Of Awesome)

⌘P go to ANYTHING (my main shortcut. Can string together eg filename:linenr)
filename opens filename
@ symbol goes to symbol occurances in current file
: linenr goes to linenr in current file
⌘⌥ right Move to next tab
⌘⌥ left Move to previous tab
⌘⇧R Go To Symbol In Project (Sublime 3)
⌘⌥ down Go To Currently Selected Definition (Sublime 3)

Multi-Cursor (Magical Unicorn Section Of Power And Speed)

Think of these as a visual search-and-replace tool

⌃⇧ up Add cursor above
⌃⇧ down Add cursor below
⌘H Quick-Add next instance to selection (modified in keymap)
⌘U Undo Quick-Add next instance to selection
⌘⌃G Select all occurrences of current word for multiple editing

Find/Replace (Textmate with Ack integration was better)

⌘F find
⌘⌥F replace
⌘⌥G find next occurrence of current word
⌘⇧F find in files

Editing

⌘⌃ up move line or selected lines up by one
⌘⌃ down move line or selected lines down by one

Further Ninja Edit Stuff

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

Layout Splitting into “Groups”

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

XML/HTML

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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment