Skip to content

Instantly share code, notes, and snippets.

@loeschg
Last active December 14, 2015 06:48
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 loeschg/5044927 to your computer and use it in GitHub Desktop.
Save loeschg/5044927 to your computer and use it in GitHub Desktop.
Some notes from the book Vi IMproved-Vim by Steve Oualline

Vi IMproved - Vim

Notes

Table Of Contents:

Undo/redo

U       - undoes all changes to the line
ctrl+r  - redoes undo

Write/quit with ZZ

Make new & join lines

J       - join the line below with the current line. 
r<enter> - start a newline from that location.

Repeat commands

.       - Repeat the previous command with the '.' key.

'G'o to line

#G      -   Go to a specific line number. No argument assumes end of line.

Vim macros

q[character]    -   start recording in register [character]
<do some stuff> -   
q               -   q macro
@[character]    -   execute the macro

Turn off search highlighting

:noh

Regular expression basics

^   -   beginning of line
$   -   end of line
.   -   any character
\   -   escape character

"Twiddling"

xp  -   Swap two characters that are side by side

Marks

m[char] -   mark location in text
`[char] -   return to the mark

Pipe text into file without leaving Vim

!![command name]    -   executes [command name] and places output in the file
e.g. !!ls           -   puts output of ls into file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment