Thursday, June 18, 2015

Re: Diff mode via Tabs



On Thu, Jun 18, 2015 at 2:57 AM, John Beckett <johnb.beckett@gmail.com> wrote:
David Fishburn wrote:
> I use gVim for diffing from my source control system using:
> gvim.exe -O -d file1.txt file2.txt

I avoid problems by working in Vim. I use some external tool to generate a list of files I want to diff, then paste it into a temporary buffer in Vim. Either the external tool or a Vim script massages the list to come up with text like this:

:tabe new1.txt
:vert diffs old1.txt

Thanks for the suggestion John.

So basically I need to run some of my own commands, like you have done above.

But I am running into the following issue.

$ gvim.exe --servername DIFF -c "echo 1"
$ gvim.exe --servername DIFF -c "echo 2"

I was hoping the 2nd call to gvim would use the already running servername DIFF, but it instead launches a new vim instance called DIFF1


So I tried some alternatives:

$ gvim.exe --servername DIFF --remote-send "echo 1"

This one tells me the vim instance DIFF isn't running (which it isn't).

$ gvim.exe --servername DIFF --remote-expr "echo 1"

Same with this one.


Basically, I am trying to do this in a Windows batch / cmd file:

function! DiffByTab( file1, file2 )
    echomsg 'F1:'.a:file1.'  F2:'.a:file2
    exec 'tabedit '.a:file1
    exec 'vert diffsplit '.a:file2
endfunction


start gvim.exe --servername DIFF -c ":call DiffByTab( '%1', '%2' )" 

I have this working, but if I call it a second time with another set of files, it just launches another instance of vim instead of using the one specified by --servername.

Dave

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment