Thursday, August 2, 2012

Re: Activating Windows gVim from the command line

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.

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

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