>
> (I assume that the oddball quotation marks are due to your mailer's
> editor.)
>
> The -c option specifies an ex command, not a normal-mode
> command. The ex search command finds the line matching the
> patterns, not the column.
>
> What you want is something like this:
>
> gvim +713 -c 'exe "normal /haddock\<CR>"' fish.cpp
>
> The quoting shown works on Unix. It's important that the :normal
> command be enclosed in double-quotes for the \<CR> to be correctly
> expanded by :exe. I don't know how to quote that properly on
> Windows, so I'll leave that to you.
>
> See
>
> :help -c
> :help :normal
> :help :silent " for an example of a :normal search command
> :help :exe
>
> Regards,
> Gary
Thanks a million, Gary and sc.
Gary your solution didn't work in Windows - it has different quoting
rules to UNIX. It's just a matter of experimentation and I will try
and bully it into submission later.
sc - your solution worked in that it correctly brought up Vim with the
cursor on the search expression. However Vim clearly does not
consider this to be a normal search, because the expression was not
highlighted and hitting 'n' (for next occurrence) did nothing.
However it gave me the break I needed because I just preceded your
":call search" action with a normal search:
gvim +712 -c "/haddock" -c ":call search('haddock')" fish.cpp
The initial -c "/haddock" sets up haddock as the current search
expression (so that all haddocks are highlighted, and hitting 'n' will
find the next one), and the ":call search" takes one to the actual
expression.
HOWEVER - note I had to subtract 1 from the line no (713) because the
"/haddock" takes one to the start of the line, and the ":call search"
starts its search from the following line. This is not perfect, and
work in progress, but at least it's progress.
Thanks again
--
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
Wednesday, August 1, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment