Your Problem with Vim is That You Don’t Grok Vi

vim_logo

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$:

This can also be expressed as dd P (delete the current line and paste a copy back into place; leaving a copy in the anonymous register as a side effect). The y and d “verbs” take any movement as their “subject.” Thus yW is “yank from here (the cursor) to the end of the current/next (big) word” and y'a is “yank from here to the line containing the mark named ‘a‘.”

If you only understand basic up, down, left, and right cursor movements then vi will be no more productive than a copy of “notepad” for you.

[ NOTE: You may also be interested in my Vim Primer here. ]

Related posts: