Edit Merge Conflicted Files With Vim Using RipGrep (Buffers and Tabs Version)

Buffer Version

rg '>>>>' -l | xargs vim


It uses rg and the flag -l to only list file paths that contain >>>> in them (conflicted files), pipes to xargs with splits each one as a param to vim.

It will say X files to edit. And you'll have all these files open in buffers. I was going throw

  • :ls command to Vim lists buffers.
  • :bd#n to close buffer where #n is the bugger number ( use ls to get it) --------- :bd2 - delete buffer # 2

Tabs Version

rg '>>>>' -l | xargs vim -p
  • vim -p a/*.php opens the same files in tabs
  • gt and gT switch tabs back and forth
  • :q closes only the current tab
  • :qa closes everything and exits
  • :tabo closes everything but the current tab
Updated Last:2023-01-05T22:32:04.000Z