Skip to content

Instantly share code, notes, and snippets.

@WayneHaworth
WayneHaworth / grok_vi.mdown
Created August 14, 2012 14:43 — forked from nifl/grok_vi.mdown
Grok Vim - an excellent summary of a few Vim features, which also exposes elegant uses of the commands

###Answer by Jim Dennis on Stack Overflow

#Your problem with Vim is that you don't grok vi.

You mention cutting with yy and complain that you almost never want to cut whole lines. In fact programmers, editing source code, very often want to work on whole lines, ranges of lines and blocks of code. However, yy is only one of many way to yank text into the anonymous copy buffer (or "register" as it's called in vi).

The "Zen" of vi is that you're speaking a language. The initial y is a verb. The statement yy is a simple statement which is, essentially, an abbreviation for 0 y$:

0 go to the beginning of this line. y yank from here (up to where?)