New answers tagged


I'm not entirely sure what's wrong with the regex, though filbranden has some thoughts in the comments. To solve the issue, though, I would do something a bit different: :global/<div>/normal! dat (delete the tag on the lines with an opening div tag).


From :h /^ At beginning of pattern or after "|", "(", "%(" or "\n": matches start-of-line; at other positions, matches literal '^'. Hence, as @ChristianBrabandt noted in comments, you must write your pattern as :'<,'>s/^\%V$//n, or alternatively, :'<,'>s/\%V\_^$//n


In tab view it is generally easy to see open tabs. Please open files in tabs: 'vim -p <file list>' Run regex and commands as: :tabdo g:stringThatMatchesRegex: | q Same can be done with :cfdo instead of (bd) buffer deletion you need to close the file using (q) :cfdo g:stringThatMatchesRegex: | q


One way is to populate the quickfix list with matches then use :cfdo to execute :bdelete :vimgrep /pat/ ## :cfdo bdelete Even though the files are closed the files are still in the argument-list. Remove them via :argdelete with % to represent the current file :vimgrep /pat/ ## :cfdo argdelete % | bdelete Additionally, I think it might be worth looking into ...

Top 50 recent answers are included