monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] Vimdiff 2 and 3-way merge support


From: Matthew A. Nicholson
Subject: Re: [Monotone-devel] Vimdiff 2 and 3-way merge support
Date: Mon, 14 Feb 2005 22:50:17 -0600
User-agent: Debian Thunderbird 1.0 (X11/20050116)

Nathaniel Smith wrote:
On Mon, Feb 14, 2005 at 04:17:12PM -0600, Matthew A. Nicholson wrote:

Here is a patch to std_hooks.lua to add vimdiff support for 2 and 3 way merge. For the merge to work, the user must save all changes in the left-most file in the vim window. (they will also have to press enter to vim's prompt when it starts)


Cool, thanks.

Umm... can you confirm that these actually work, in light of your last
email message, though?  I'll wait to apply them until then :-).

-- Nathaniel


Fixed.  Gvim was backgrounding it self.

--
Matthew A. Nicholson
Matt-land.com
--- std_hooks.lua       2004-12-31 02:16:56.000000000 -0600
+++ ../mon/std_hooks.lua        2005-02-14 16:00:52.000000000 -0600
@@ -132,6 +132,16 @@
 
 -- merger support
 
+function merge2_vim_cmd(vim, lfile, rfile, outfile)
+   local cmd_fmt = "%s -d -c \"file %s\" \"%s\" \"%s\""
+   return string.format(cmd_fmt, vim, outfile, lfile, rfile)
+end
+
+function merge3_vim_cmd(vim, lfile, afile, rfile, outfile)
+   local cmd_fmt = "%s -d -c \"file %s\" \"%s\" \"%s\" \"%s\""
+   return string.format(cmd_fmt, vim, outfile, lfile, afile, rfile)
+end
+
 function merge2_emacs_cmd(emacs, lfile, rfile, outfile)
    local elisp = "'(ediff-merge-files \"%s\" \"%s\" nil \"%s\")'"
    local cmd_fmt = "%s -no-init-file -eval " .. elisp
@@ -211,6 +221,10 @@
          cmd = merge2_emacs_cmd("emacs", lfile, rfile, outfile)
       elseif program_exists_in_path("xemacs") then
          cmd = merge2_emacs_cmd("xemacs", lfile, rfile, outfile)
+      elseif program_exists_in_path("gvim") then
+         cmd = merge2_vim_cmd("gvim -f", lfile, rfile, outfile)
+      elseif program_exists_in_path("vim") then
+         cmd = merge2_vim_cmd("vim", lfile, rfile, outfile)
       end
 
       if cmd ~= nil
@@ -259,6 +273,10 @@
          cmd = merge3_emacs_cmd("emacs", lfile, afile, rfile, outfile)
       elseif program_exists_in_path("xemacs") then
          cmd = merge3_emacs_cmd("xemacs", lfile, afile, rfile, outfile)
+      elseif program_exists_in_path("gvim") then
+         cmd = merge3_vim_cmd("gvim -f", lfile, afile, rfile, outfile)
+      elseif program_exists_in_path("vim") then
+         cmd = merge3_vim_cmd("vim", lfile, afile, rfile, outfile)
       end
 
       if cmd ~= nil

reply via email to

[Prev in Thread] Current Thread [Next in Thread]