thinca / vim-qfreplace

Perform the replacement in quickfix.
160 stars 5 forks source link

Suppress error messages in a certain condition #12

Closed nsfisis closed 3 years ago

nsfisis commented 3 years ago

Description

This change is for suppressing error messages reported when trying to perform the same replacement against the same line.

When a line has several same words, some grep tools like ripgrep generate multiple QuickFix entries for each match.

Example:

File (a.txt):

foo foo foo

Command result:

$ rg --vimgrep foo  # Run ripgrep command with --vimgrep flag
a.txt:1:1:foo foo foo
a.txt:1:5:foo foo foo
a.txt:1:9:foo foo foo

When you replace all "foo" with "bar" in qfreplace buffer and write the buffer, qfreplace reports error: "qfreplace: Original text has changed". However, it is a false positive error.

thinca commented 3 years ago

Thank you! Sorry for very lazy.