You are not logged in.

#1 2022-06-30 12:25:29

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Vimdiff or vim plugin to easily merge foo.c and foo.c.rej

Can someone recommend a method to merge foo.c and foo.c.rej easily within vim?  The .rej file shows diffs with the - and + sign so the plugin would allow one to split-screen the two, line them up automatically, then easily grab the blocks inserting or deleting them as they should be as if manually typed.  Thanks for the suggestions.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#2 2022-07-01 11:10:42

willemw
Member
Registered: 2013-02-19
Posts: 113

Re: Vimdiff or vim plugin to easily merge foo.c and foo.c.rej

'patch --merge ...' changes foo.c to a file with merge conflicts (blocks between <<<<<<<, ||||||| and >>>>>>>), similar to what you see when merging files in git. That format may be more compatible with vim/nvim plugins out there. At least that format is more readable. You may not even need a plugin then.

Or put all the source files in a local git repo and apply the patch file with 'git apply'. Then optionally run 'git mergetool' or a plugin for a more visual diff.

Offline

Board footer

Powered by FluxBB