- Compare the selected files or the current folders (1 items selected on each panel - compare those, 2 items selected on the active panel - compare those, otherwise compare active panel folder and passive panel folder)
- Compare the current files/folders (compare active panel file/folder with passive panel file/folder)
Runs WinMerge from the command line, can be easily modified to use another GUI merge tool.
Code: Select all
local function winmerge(File1, File2, swap)
if swap then
Tmp = File2
File2 = File1
File1 = Tmp
end
Keys("Esc")
Far.DisableHistory(0)
print('winmerge "' .. File1 .. '" "' .. File2 .. '"')
Keys("Enter")
end
Macro {
area="Shell"; key="CtrlM"; description="WinMerge: Compare the selected files or the current folders";
action = function()
if APanel.SelCount == 1 then
File1 = APanel.Path .."\\" .. panel.GetSelectedPanelItem(nil, 1, 1).FileName
if PPanel.SelCount == 1 then
File2 = PPanel.Path .."\\" .. panel.GetSelectedPanelItem(nil, 0, 1).FileName
else
File2 = PPanel.Path .."\\" .. panel.GetSelectedPanelItem(nil, 1, 1).FileName
end
winmerge(File1, File2, not APanel.Left)
elseif APanel.SelCount == 2 then
File1 = APanel.Path .."\\" .. panel.GetSelectedPanelItem(nil, 1, 1).FileName
File2 = APanel.Path .."\\" .. panel.GetSelectedPanelItem(nil, 1, 2).FileName
winmerge(File1, File2, false)
else
winmerge(APanel.Path, PPanel.Path, not APanel.Left)
end;
end;
}
Macro {
area="Shell"; key="CtrlShiftM"; description="WinMerge: Compare the current files/folders";
action = function()
File1 = panel.GetPanelDirectory(nil, 0).Name .. "\\" .. panel.GetCurrentPanelItem(nil, 0).FileName
File2 = panel.GetPanelDirectory(nil, 1).Name .. "\\" .. panel.GetCurrentPanelItem(nil, 1).FileName
winmerge(File1, File2, not APanel.Left)
end;
}