Выкладываю макрос для FAR3, основанный на "WinMerge Macro" by gene.pavlovsky ( http://forum.farmanager.com/viewtopic.php?f=35&t=9769 ).
Code: Select all
local winmerge_path = 'winmerge'
local bincmp_path = 'bincmp'
local function run_cmd(cmd, use_console)
if use_console then
Keys("Esc")
print(cmd)
Keys("Enter")
else
win.system(cmd)
end
end
local function file_name(filepath)
return mf.fsplit(filepath, 0x0C)
end
local function full_path(dir, filename)
if filename:len() >= 2 then
local c = filename:sub(2, 2)
if c == ':' or ((c == '\\' or c == '/') and c == filename.sub(1, 1)) then
-- filename is either "X:..." or "\\..." or "//..."
return filename
end
end
return dir .. "\\" .. filename
end
local function winmerge(path1, path2)
local files = '"' .. path1 .. '" "' .. path2 .. '"'
run_cmd(winmerge_path .. ' /r ' .. files, false)
end
local function bincmp(path1, path2, swap)
local files = '"' .. path1 .. '" "' .. path2 .. '"'
run_cmd('edit:<1 ' .. bincmp_path .. ' -err1 -diffs=10000 -buf=16k -t=5000 ' .. files, true)
end
local function compare(comparer)
local path1
local path2
if APanel.SelCount == 2 then -- Compare 2 selected files from the Active Panel
path1 = full_path(APanel.Path, panel.GetSelectedPanelItem(nil, 1, 1).FileName)
path2 = full_path(APanel.Path, panel.GetSelectedPanelItem(nil, 1, 2).FileName)
else -- Compare current files from different Panels
local dir1 = panel.GetPanelDirectory(nil, 1).Name
local dir2 = panel.GetPanelDirectory(nil, 0).Name
local file1 = panel.GetCurrentPanelItem(nil, 1).FileName
local file2 = panel.GetCurrentPanelItem(nil, 0).FileName
if file1 == ".." then
path1 = full_path(dir1, file_name(file2))
path2 = full_path(dir2, file2)
elseif file2 == ".." then
path1 = full_path(dir1, file1)
path2 = full_path(dir2, file_name(file1))
else
path1 = full_path(dir1, file1)
path2 = full_path(dir2, file2)
end
end
comparer(path1, path2)
end
Macro {
area = "Shell";
key = "cmp_winmerge";
description = "Compare with WinMerge";
action = function()
compare(winmerge)
end;
}
Macro {
area = "Shell";
key = "cmp_bincmp";
description = "Compare with BinCmp";
action = function()
compare(bincmp)
end;
}
Code: Select all
F9: Compare with BinCmp
lua:eval("Shell/cmp_bincmp",2)
F10: Compare with WinMerge
lua:eval("Shell/cmp_winmerge",2)
и его 7-zip плагин здесь: https://sourceforge.net/projects/winmer ... ip-plugin/
BinCmp берём здесь: https://sourceforge.net/projects/bincmp/files/bincmp2/