This is a read-only archive!

Vim: Expression register

Today's Vim discovery is the expression register, "=. I wanted to insert the value of a Vim option (namely iskeyword) into a buffer so I could edit / play with it. Normally I'd have done

:set iskeyword?

to display the value, and then typed the result out by hand by reading what it output. But you can use the expression register to paste it directly. In Normal mode:

"=&iskeyword<CR>p

(where <CR> means hit Enter). When you do "= in Normal mode, it prompts you to give it an expression. When you hit enter, it will evaluate the expression and use the result as the contents of the register. See also :h quote=<.

June 28, 2007 @ 2:32 AM PDT
Cateogory: Programming
Tags: Vim