Another approach, depending on your use case, will use vimgrep , and its results will be quickfix . You can do the following:
:vimgrep pattern % will search for the current file and bring you to the first search result. More importantly, it also puts the results on the quickfix list.
:copen will open the quick delete list in a separate quick fix window. This way you will have a separate window with all the lines from your last vimgrep. In the quickfix window, you can press Enter or double-click on a line to go to the corresponding line in the source file.
:colder will allow you to revert to old fastfix lists (older vimgrep results). And :cnewer moving on to newer search results.
Please note that the quickfix list is also updated at startup :make (which is why it is called quickfix for error correction). Because of this, there is also an alternative to the quick fix list called the βlocation listβ. Instead, you use :lvimgrep , then use the l-prefixed commands, not the c-prefixed - :lopen :lolder :lnewer .
There is, of course, much more that you can do. See :help quickfix .
PS, You said that you do not need an approach that deletes lines and then cancels them. But since you marked g/ERROR as the answer, I thought I would point out a quick and dirty way to do g!/ERROR/d . Then you can easily undo it using u . You can also do FYI :set hlsearch to highlight patterns matching the commands :g .
studgeek Sep 18 '12 at 23:26 2012-09-18 23:26
source share