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

132618Re: Activating Windows gVim from the command line

Expand Messages
  • Tony Mechelynck
    Aug 2 12:32 PM
    • 0 Attachment
      On 02/08/12 16:30, Ben Fritz wrote:
      > On Thursday, August 2, 2012 12:21:02 AM UTC-5, His Nerdship wrote:
      >>
      >>
      >> I have found a working solution:
      >>
      >> gvim -c "/haddock" +713 -c ":call search('haddock','c')" fish.cpp
      >>
      >>
      >>
      >> First do the '/' search, then go to the specified line, then do the
      >>
      >> ":call search"
      >
      > I'm glad you got it working, and I don't see any reason to change it.
      >
      > I do have one minor note which may save you some trouble in the future.
      >
      > You seem to think vim -c "/pattern" performs a '/' search. It doesn't. What it is doing is specifying the first line of an ex command range via a pattern. I'm not sure where it's documented but specifying a single-line range with no command will just set the cursor to that line.

      It has ho helptag of its own, but it is documented as :[range], just
      after ":help gg", in the section about up and down motions.

      ":help +cmd" and ":help [range]" (the section which includes the
      ":range" overview you mention below) are also relevant because more
      detailed, but the section about +something as a Vim argument is ":help -+c".

      >
      > :help :range gives details. I wonder if you could make use of a ";" in your range to accomplish what you want with a shorter command.
      >

      ...for instance
      gvim +713;/haddock/ -c "call search('haddock','c')" fish.cpp
      for the first "haddock" after line 713 (i.e. on line 714 or after).

      This will also find chaddocks if present. See
      :help /\<
      :help /\>
      about specifying word boundaries in a pattern.


      Best regards,
      Tony.
      --
      This is the _LAST_ time I take travel suggestions from Ray Bradbury!

      --
      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
    • Show all 7 messages in this topic