I have 2 large files to take vimdiff. In vimdiff output I want to ignore lines showing diff but have a particular word.
e.g. in my case I want to ignore diff of all lines with prefix WARNING: in my files.
Thanks,
I've looked for a solution to this for a long time and I found the EnhancedDiff plugin to be the easiest solution which makes your diffs slightly more intelligent to begin with :)
Use the plugin manager of your choice:
git clone https://github.com/chrisbra/vim-diff-enhanced.git ~/.vim/bundle/vim-enhanced-diff:Helptags (only needed once after the installation to install the documentation)NeoBundle 'chrisbra/vim-diff-enhanced'Plugin 'chrisbra/vim-diff-enhanced'Plug 'chrisbra/vim-diff-enhanced'Using vimdiff, nvim -d or diffthis for example
:EnhancedDiffIgnorePat ^WARNING:.*
:diffupdate
Why don't you filter the files before invoking vimdiff?
grep -v "^WARNING" file1 > file1_w;
grep -v "^WARNING" file2 > file2_w;
vimdiff file1_w file2_w
If you're using Bash or zsh, you can do it with a single command:
vimdiff <(grep -v "^WARNING" file1) <(grep -v "^WARNING" file2)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With