Skip to content

Instantly share code, notes, and snippets.

@jmahony
Last active October 2, 2015 07:37
Show Gist options
  • Save jmahony/9e7738d39457ee68fe9a to your computer and use it in GitHub Desktop.
Save jmahony/9e7738d39457ee68fe9a to your computer and use it in GitHub Desktop.
Vim Notes

Vim Notes

Editing

guu Lowercase line

gUU Uppcase line

Searching

* search for other instances of the word under your cursor

n go to the next instance when you’ve searched for a string

N go to the previous instance when you’ve searched for a string

; go to the next instance when you’ve jumped to a character

, go to the previous instance when you’ve jumped to a character

Indenting

>% Increase indent of a braced or bracketed block (place cursor on brace first)

=% Reindent a braced or bracketed block (cursor on brace)

<% Decrease indent of a braced or bracketed block (cursor on brace)

Selection

gv Reselect last selection

Find and Replace

Replace in selection

  1. Press v and make your selection.
  2. Press : and issue the command '<,'>s/hello/world

Replace with regex and backreference

:%s/<a href="\(.*\)">/<a href="\1" itemprop="url">

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