On 2010-08-12, Daniel Fetchinson wrote:
> Hi folks,
> 
> I use * regularly to search for words and the results are nicely
> highlighted. Many times I need to copy these terms after the : prompt
> (what is its name? command prompt? status bar?) for example when I
> need to grep for it in other files or search-and-replace it, etc.
> 
> Is this possible?

The : begins an ex command.  The part of the display on which you
enter ex commands is the command line.

There are a number of ways to do this.

1.  If the cursor is still on the desired word when you begin the ex
    command, you can insert that word into the command by typing
    Ctrl-R Ctrl-W.  See

        :help c_CTRL-R_CTRL-W

2.  Yank the word into a register before beginning the ex command.
    For example,

        yiw

    will yank the word the cursor is in to the default register.
    Then you can insert the contents of that register into the ex
    command by typing Ctrl-R " .  (That's Ctrl-R followed
    immediately by a double-quote.)  See

        :help c_CTRL-R

3.  Insert the contents of the search pattern register (named '/')
    into the ex command by typing Ctrl-R / .  See

        :help c_CTRL-R

    That has the feature that it will include the '\<' and '\>' at
    the beginning and end of the pattern, which may or may not be
    what you want.

Regards,
Gary

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

Reply via email to