Skip to content

Instantly share code, notes, and snippets.

@ajeesh-george
Forked from lucasfais/gist:1207002
Last active December 16, 2015 20:49
Show Gist options
  • Save ajeesh-george/5495535 to your computer and use it in GitHub Desktop.
Save ajeesh-george/5495535 to your computer and use it in GitHub Desktop.

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

VIM cheat Sheet
-——————-

Text Entry Commands (Used to start text entry)

a Append text following current cursor position

A Append text to the end of current line

i Insert text before the current cursor position

I Insert text at the beginning of the cursor line

o Open up a new line following the current line and add text there

O Open up a new line in front of the current line and add text there

The following commands are used only in the commands mode.

Cursor Movement Commands

h Moves the cursor one character to the left

l Moves the cursor one character to the right

k Moves the cursor up one line

j Moves the cursor down one line

nG or :n Cursor goes to the specified (n) line
(ex. 10G goes to line 10)

^F (CTRl F) Forward screenful

^B Backward screenful

^f One page forward

^b One page backward

^U Up half screenful

^D Down half screenful

$ Move cursor to the end of current line

0 (zero) Move cursor to the beginning of current line

w Forward one word

b Backward one word

Exit Commands

:wq Write file to disk and quit the editor

:q! Quit (no warning)

:q Quit (a warning is printed if a modified file has not been saved)

ZZ Save workspace and quit the editor (same as :wq)

Text Deletion Commands

x Delete character

dw Delete word from cursor on

db Delete word backward

dd Delete line

d$ Delete to end of line

d^ (d caret, not CTRL d) Delete to beginning of line

Yank (has most of the options of delete)— VI’s copy commmand

yy yank current line

y$ yank to end of current line from cursor

yw yank from cursor to end of current word

5yy yank, for example, 5 lines

Paste (used after delete or yank to recover lines.)

p paste below cursor

P paste above cursor

“2p paste from buffer 2 (there are 9)

u Undo last change

U Restore line

J Join next line down to the end of the current line

File Manipulation Commands

:w Write workspace to original file

:w file Write workspace to named file

:e file Start editing a new file

:r file Read contents of a file to the workspace

Other Useful Commands

Most commands can be repeated n times by typing a number, n, before
the command. For example 10dd means delete 10 lines.

cw Change current word to a new word

r Replace one character at the cursor position

R Begin overstrike or replace mode – use ESC key to exit

:/ pattern Search forward for the pattern

:? pattern Search backward for the pattern

n (used after either of the 2 search commands above to
continue to find next occurrence of the pattern.

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