Sat, 02 Mar 2013

VIM Cheat Sheet

Here are just a few VIM commands that come in pretty useful.

Cursor movement
hmove left
jmove down
kmove up
lmove right
wjump by start of words (punctuation considered words)
Wjump by words (spaces separate words)
ejump to end of words (punctuation considered words)
Ejump to end of words (no punctuation)
bjump backward by words (punctuation considered words)
Bjump backward by words (no punctuation)
0(zero) start of line
^first non-blank character of line
$end of line
GGo To command (prefix with number)
Inserting/Appending text
istart insert mode at cursor
Iinsert at the beginning of the line
aappend after the cursor
Aappend at the end of the line
oopen (append) blank line below current line (no need to press return)
Oopen blank line above current line
eaappend at end of word
Escexit insert mode
Editing
rreplace a single character (does not use insert mode)
Jjoin line below to the current one
ccchange (replace) an entire line
cwchange (replace) to the end of word
c$change (replace) to the end of line
sdelete character at cursor and subsitute text
Sdelete line at cursor and substitute text (same as cc)
xp"transpose two letters (delete and paste technically)"
uundo
.repeat last command
Marking text (visual mode)
v"start visual mode mark lines then do command (such as y-yank)"
Vstart Linewise visual mode
omove to other end of marked area
Ctrl+vstart visual block mode
Omove to Other corner of block
awmark a word
aba () block (with braces)
aBa {} block (with brackets)
ibinner () block
iBinner {} block
Escexit visual mode
Visual commands
>shift right
<shift left
yyank (copy) marked text
ddelete marked text
~switch case
Cut and Paste
yyyank (copy) a line
2yyyank 2 lines
ywyank word
y$yank to end of line
pput (paste) the clipboard after cursor
Pput (paste) before cursor
dddelete (cut) a line
dwdelete (cut) the current word
xdelete (cut) current character
Exiting
:w"write (save) the file but don't exit"
:wqwrite (save) and quit
:qquit (fails if anything has changed)
:q!quit and throw away changes
Search/Replace
/patternsearch for pattern
?patternsearch backward for pattern
nrepeat search in same direction
Nrepeat search in opposite direction
:%s/old/new/greplace all old with new throughout file
:%s/old/new/gcreplace all old with new throughout file with confirmations
Working with multiple files
:e filenameEdit a file in a new buffer
:bnext (or :bn)go to next buffer
:bprev (of :bp)go to previous buffer
:bddelete a buffer (close a file)
:sp filenameOpen a file in a new buffer and split window
ctrl+wsSplit windows
ctrl+wwswitch between windows
ctrl+wqQuit a window
ctrl+wvSplit windows vertically

posted: 15:58 | path: /reference | permalink | comments: 0 | tags: reference, vim

Tue, 29 Jan 2013

First post!

Hello! If you're reading this then I have finally gotten around to setting up my blog. As you can see there isn't much here right now and I hope to post more in the future.

What's running the show?

It's a pretty simple affair. A low cost VPS just to host this site and an IRC server (which you're welcome to use, if you want). Here is what it's running:

posted: 19:37 | path: / | permalink | comments: 0 | tags: blog