Saturday, September 11, 2010

Re: How to copy the name of the variable / function under the cursor?

On 09/11/10 12:15, Ven Tadipatri wrote:
>>> "+yiw
>
> I'm sorry - I'm not understanding what you're doing here. Wouldn't 'i'
> put you into insert mode and then there would be a 'w' character
> that's pasted.
> Whever I want to paste, I just use 'P'.

"iw" in this context is a "text object" ("inner word") and can be
used like a motion. Just as you'd use

y<motion>

to yank over whatever characters were covered by <motion> (such
as "42G" to yank from the current line to line 42, or "$" to yank
to the end of the line), you can use a text object. In this
case, the "<motion>" is the "iw" text object.

They're a phenomenal feature of Vim and I use them regularly.
You'll want to read up at

:help text-objects

for all the good stuff, but Vim knows how to operate on a number
of different things like sentences, "stuff in paired delimiters"
(such as parens, square & curly brackets, single & double
quotation marks, paragraphs, etc).

Hope this not only helps you understand what it's doing, but
opens the door to more efficient editing. :)

-tim


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment