Loading ...
Sorry, an error occurred while loading the content.

Re: search/paste question

Expand Messages
  • A.J.Mechelynck
    ... Similarly, after a yank, you can use Ctrl-R on the command-line to put the yanked value there (Ctrl-R for the default register, or Ctrl-R followed by the
    Message 1 of 3 , Jun 5, 2007
    • 0 Attachment
      Tim Chase wrote:
      >> I see you can "/text" to search, and do "*" to find the next
      >> occurrence of the word under the cursor, but how do you paste
      >> text that you've just yank'd, into the search line after you
      >> press / without using the mouse?
      >
      >
      > You can use control+R followed by "/" to insert the text of the
      > last search.
      >
      > :help i_CTRL-R
      > :help c_CTRL-R
      >
      > (both are pretty much the same, as it works in both insert mode
      > and command-line mode). This allows you access to any of vim's
      > registers from insert mode or command-line mode--not just the
      > search, but the file-name, the a-z registers, etc.
      >
      > :help registers
      >
      > Note that when you shift from using "/text" to using "*", you'll
      > get a subtle shift in your search pattern, as "*" tacks on "\<"
      > and "\>" around your word to ensure a whole-word pattern. These
      > extra characters are part of the search pattern and will thus be
      > included/pasted when you use the above control+R/ method. You
      > may want to use n/N for searching for the next/previous instance
      > of your pattern instead.
      >
      > -tim
      >
      >
      >

      Similarly, after a yank, you can use Ctrl-R on the command-line to put the
      yanked value there (Ctrl-R " for the default register, or Ctrl-R followed by
      the register name if you yanked into a named register).


      Best regards,
      Tony.
      --
      Q: Do you know what the death rate around here is?
      A: One per person.
    Your message has been successfully submitted and would be delivered to recipients shortly.