Thursday, August 2, 2012

Re: Activating gVim from the command line (cont)

On Aug 3, 12:39 am, Ben Fritz <fritzophre...@gmail.com> wrote:
> You may need to use the --remote-expr or --remote-send flags instead of (or in addition to) the --remote flag. Also see the remote_expr(), remote_peek(), remote_read(), and remote_send() functions for use within an already-running Vim.- Hide quoted text -
>
> - Show quoted text -

Thanks again Ben. I have found a solution which ticks all the above
boxes:
* It works both for a new Vim instance and an existing one (as long as
the server name is the same, as you suggested)
* A subsequent search works, i.e it will look for blobfish, not
haddock:

gvim --servername HgVim --remote-silent "+51;/blobfish/;:call
search('blobfish','c')" fish.cpp

However it adds a new twist, albeit a trivial one. I have to
decrement 1 from the line number. In the above example, if 'blobfish'
is on line 52 and I specify +52 in the command, it will actually start
from line 53. This is not important as I can easily code around that,
even if the search expression is on line 1 (just specify '+0').
If you know of a way round this it would be good but as I said, it's
not a showstopper.
Really appreciate the help you give to me and everyone else.

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