Skip to content

Instantly share code, notes, and snippets.

@appym
Last active December 28, 2018 23:50
Show Gist options
  • Save appym/0f5d285c32f4d81d9ee4f640189d793a to your computer and use it in GitHub Desktop.
Save appym/0f5d285c32f4d81d9ee4f640189d793a to your computer and use it in GitHub Desktop.
VI cheat sheet

String replace global in VI

:%s/search_string/replacement_string/g

delete All lines in a file

dG

delete first 30 lines in a file

1G
30dd

To go to first line of file

gg

or

1G

To go to last line of file

G

To copy all contents of a file to clipboard

:%y+

or go to first line of file and copy

gg"*yG

Paste from clipboard

"*p

* is a register. you can also use +

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