Skip to content

Instantly share code, notes, and snippets.

@mikaelz
Last active December 17, 2015 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikaelz/5642227 to your computer and use it in GitHub Desktop.
Save mikaelz/5642227 to your computer and use it in GitHub Desktop.
VIM snippets, special searching and parsing
Search empty CSS selectors
/{\n\t\n}
Change filetype, syntax (htt, tpl, etc.)
:set ft=html.php
Delete every line in the file that does match a pattern
:g/pattern/d
Delete every line in the file that does not match a pattern
:v/pattern/d
Replace 2 or more spaces - http://stackoverflow.com/a/3860542/289404
:s/ \{2,}/ /g
Jumping long distance - http://vimuniversity.com/samples/jumping-long-distances
nG - jump to line n ("line 5, Go")
C-o - jump backwards ("out")
C-i - jump forwards ("in")
L - jump to bottom of screen ("low")
M - jump to middle of screen ("middle")
H - jump to top of screen ("high")
zt - put this line at the 't'op of the screen
zb - put this line at the 'b'ottom of the screen
zz - put this line at the middle of the screen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment