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

Re: yanking into register and using that in command

Expand Messages
  • Gautam Iyer
    ... The on command line expands to the word under the cursor. I generally use command! PartialWordGrep grep -I *.* in my ~/.vimrc, which is
    Message 1 of 4 , Aug 2, 2006
    • 0 Attachment
      On Tue, Aug 01, 2006 at 05:25:44PM -0700, Denis Perelyubskiy wrote:

      > I am trying to emulate textpad. In textpad, when cursor is over some
      > word and you press ctrl-f5 the search box pops up, and a word is in the
      > input area.
      >
      > So, an equivalent behavior (at least for now :-)) in vim is to press
      > ctrl-f5 and have a word show up in the string
      > :vimgrep/WORD/j c:/projects/foo/**/*.[ch]
      >
      > I know how to do this in a kludgy way, by yanking the word with viwy.
      > However, that "kills" the * register. The question is whether it is
      > possible to do what i want through some temp register, without
      > "killing" the * (or using the * and then restoring it):

      The <cword> on command line expands to the word under the cursor. I
      generally use

      command! PartialWordGrep grep -I <cword> *.*

      in my ~/.vimrc, which is similar to what you want to do. You can modify
      as needed. Also relevant would be the expand() function.

      GI

      --
      POLITICS THROUGH COWS -- A TALIBAN CORPORATION:
      You have all the cows in Afghanistan, which is two. You don't milk them
      because you cannot touch any creature's private parts. At night when no
      one is looking, you milk both of them. Then you kill them and claim a US
      bomb blew them up while they were in the hospital.
    Your message has been successfully submitted and would be delivered to recipients shortly.