[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-devel] Vimdiff 2 and 3-way merge support
From: |
Matthew A. Nicholson |
Subject: |
[Monotone-devel] Vimdiff 2 and 3-way merge support |
Date: |
Mon, 14 Feb 2005 16:17:12 -0600 |
User-agent: |
Debian Thunderbird 1.0 (X11/20050116) |
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)
--
Matthew A. Nicholson
Digium
--- 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", 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", lfile, afile, rfile, outfile)
+ elseif program_exists_in_path("vim") then
+ cmd = merge3_vim_cmd("vim", lfile, afile, rfile, outfile)
end
if cmd ~= nil
- [Monotone-devel] Vimdiff 2 and 3-way merge support,
Matthew A. Nicholson <=