I can customize some error display in my file like highlight all white space at the end of each line by:
:match ErrorMsg /\s\+$/
Can I put all the error I found into quickfix windows that I can go through it one by one?
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.Sign up to join this community
You can use
:vimgrep /pattern/ % to search the current file for
pattern and put the results in the quickfix list.
There is also
:grep which works in the same way but uses an external program to do the search.
You did not ask for it but in simple situations (like removing trailing spaces) you can also use the
:substitute command. For example with
you will be walked through every match in the file and can confirm if you want it removed. (
e is to ignore errors like "no matches found" and
c is for interactive confirming every replacement)