Skip to content

Instantly share code, notes, and snippets.

@skube

skube/sublime-helpful.md

Last active Feb 27, 2020
Embed
What would you like to do?
VIM & Sublime

Vintage Mode & Emmet in Sublime Text

The following are a mish-mash of VIM, Sublime Text (in Vintage mode with Vintageous package) and Emmet commands.

The key to using VIM is to stay in COMMAND MODE as much as possible. Think of VIM as a language (although subject-verb-object order may differ from your spoken language). Commands can be combined. Learn by doing, not by memorizing.

Remember, there is always a built-in VIM tutor on OSX just type vimtutor in the terminal.

Note: ||Ctrl (aka Super key) means use Command key for OS X or Control key for Windows. Italicized indcates placeholders.

In this document:

Some favs to use more right now

Key Description
ea append at end of word
m [a-z0-9] (book)mark current cursor position with register (any key [a-z0-9])
' [a-z0-9] Return to marked position [a-z0-9] (first non-blank character in line)
Ctrl + + g Find All instances
` [a-z0-9] jump to line and column of mark
'' toggle line position before jump (two apostrophes)
`` toggle cursor position before jump (two back ticks)
Ctrl + w (OS X)
Ctrl+Shift + G (Win)
Wrap with abbreviation
(use w/ `ul>li*
. repeat last action
[cdVy]n[jk] change, delete, visual or yank
n number of lines down or up in addition to current line (w/ Vintageous package)
Shift + Vngg select current line up to line number n
||Ctrl + kc scroll cursor to centre
[cdvy]aw Change, delete (& copy), visual or yank all word with trailing space
[cdvy]iw Change, delete (& copy), visual or yank inner word
Shift + * Find next word matching cursor (from anywhere within word)
Shift + ^ Within line, jump to first non-white space character (tip: left shift)
d Shift + _ Delete line without taking linefeed/newline
||Ctrl+Shift + K Clear entire line (doesn't keep in clipboard)
Shift + D Delete to end of line (unlike dd which deletes full line)
d Shift + $ Delete to end of line (same as above)
Shift + % Jump to open/close brace (), {}, or [] (or matching html tag if in word)
gg = Shift + G (go to top and) format entire file
gg > Shift + G (go to top and) indent entire file
:reg + Enter show registry history
Shift + ~ Toggle case of selection or cursor
q [a-z] Starts recording macro (in normal mode) to the specified register (a-z)
- displays recording... in the status line
- Type any normal mode commands, or enter insert mode and type text
q Stops recording (in normal mode)
Shift + @ [a-z] Playback your keystrokes:
- press @ followed by the letter previously chosen
- [optional] Typing @@ repeats the last playback.

Finding

Key Description
fx find x and land on it (current line only)
Shift + Fx Jump back on x (opposite of above, current line only)
tx 'til x but land before it (current line only)
Shift + Tx Jump back 'til x (opposite of above, current line only)
/ enter find
* set find all word & find next
n find next
Shift + N find previous
||Ctrl + i incremental find (not quite same as + d)
Ctrl + + g Find All instances

Go To

Key Description
Shift + G Go page bottom
gg Goto top (think goto 1 line)
ngg Goto line n
n Shift + G Go line n (alternate

Jumping Around

Key Description
w jump to next (non-space) word (tip: regex)
e jump to end of current word
b jump back to previous word
Shift + W jump to next word (delimited by whitespace, be it tab, space or newline)
Shift + E jump to end of current word (delimited by whitespace, be it tab, space or newline)
Shift + B jump to beginning of previous word (delimited by whitespace, be it tab, space or newline)
Shift + ^ jump to first non-blank character on line (tip: left shift)
Shift + _ jump to first non-blank character of the line (same as above)
Shift + $ jump to last non-white space character on line (tip: right shift)
g Shift + _ jump to last non-blank character of the line (same as above)
Shift + * jump to next word matching cursor (case insensitive)
Shift + # jump to previous word matching cursor
Shift + } Go next paragraph empty space
Shift + { Go previous paragraph empty space
Shift + H move to high (header) part of screen
Shift + M move to middle of screen
Shift + L move to lower part of screen
zz scroll current line to middle of page
||Ctrl + f scroll page forward doesn't work in Sublime
||Ctrl + b scroll page back doesn't work in Sublime
Shift + % Jump to open/close (), {}, or []
o While in Visual, toggles cursor position start/end

Bookmarking (to jump)

Key Description
m [a-z0-9] (book)mark current cursor position with register (any key [a-z0-9])
' [a-z0-9] Return to marked position [a-z0-9] (first non-blank character in line)
` [a-z0-9] jump to line and column of mark
[cdy] ' [a-z0-9] change, delete or yank from current line to line of mark
[cdy] ` [a-z0-9] change, delete or yank from current cursor position to position of mark
'' toggle last marks
||Ctrl+F2 Toggle Bookmark (with indicator)
F2 Jump to Next bookmark
Shift+F2 Jump to Previous bookmark
Shift+||Ctrl+F2 Clear all bookmarks

Going into Insert Mode

Key Description
s delete character under cursor
i Insert infront cursor
a Append after cursor
Shift + I Insert infront of line (tip: left shift indicates direction)
Shift + A Append after line end (tip: right shift indicates direction)
o Open newline below
Shift + O Open newline above (tip: shift ⇧)
c Change/cut (i.e. cw = deletes word)
caw Change/cut all word
cc Change/cut entire line
ci" Change inner quote content
(can be anywhere before for quotes, but has to be within for parenthses)
cit Change inner tag

Cut/Copy/Paste (staying in Command Mode)

Key Description
d delete (cuts)
dd delete (cuts) entire line
d Shift + _ delete line without taking linefeed/newline
num dd deletes num lines
dit delete inner tag content
y yank (copy) selection
yy yank entire line
r replace single character (stays in command mode)
x delete single character (stays in command mode)
Shift + X delete previous single character
p paste after cursor
Shift + P paste above (⇧) line
d num Enter deletes num lines from current position in line to current position
(not entire line)
y num p copies line num times
daw delete (& copy) entire word with trailing space
d3w delete (& copy) 3 words
(starting from wherever cursor is)
" register y yank to register
(use :reg to view register)
" register p paste from register
(use :reg to view register)

Selecting

Key Description
v switch into visual mode
Shift + V selects line (goes into visual mode)
Shift + Vngg select current line up to line number n
Shift + Vnj select current + down n lines
Alt + F3 select all under cursor

Undo/Redo

Key Description
u undo
Shift + U undo all changes to current line
||Ctrl + r redo
. repeat last action

Recording Macros

Key Description
q [a-z] Starts recording macro (in normal mode) to the specified register (a-z)
- displays recording... in the status line
- Type any normal mode commands, or enter insert mode and type text
q Stops recording (in normal mode)
Shift + @ [a-z] Playback your keystrokes:
- press @ followed by the letter previously chosen
- [optional] Typing @@ repeats the last playback.

General Sublime Shortcuts

The Almightly k (for key chords?)

Key Description
||Ctrl + k create split pane
||Ctrl + k remove split pane
||Ctrl + ka show all lint errors
||Ctrl + ku uppercase
||Ctrl + kl lowercase
||Ctrl + kt hide (fold) all tag attributes
||Ctrl + k0 expand all code
||Ctrl + k1 collapse/fold all 1 tab indentations
||Ctrl + k2 collapse/fold all 2 tab indentations
||Ctrl + kb toggle side bar
||Ctrl + kv paste from history
||Ctrl + kc scroll cursor to centre
Shift+||Ctrl + K highlight matching tags (good for swapping tag)

Emmet

Key Description
Ctrl + w (OS X - Make sure Vintegeous is disabled)
Ctrl+Shift + G (Win)
Wrap with abbreviation
(use w/ `ul>li*
Ctrl+Shift + W (OS X)
Alt+Shift + W (Win)
Wrap with tag (alternate to above)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment