Use argdo with search pattern to delete line while suppressing errors and requiring confirmation in Vim
        Posted  
        
            by 
                richardh
            
        on Super User
        
        See other posts from Super User
        
            or by richardh
        
        
        
        Published on 2012-05-31T02:25:03Z
        Indexed on 
            2012/05/31
            4:43 UTC
        
        
        Read the original article
        Hit count: 317
        
vim
I use gVim 7.3.46 on Win 7.
It is pretty straightforward to use argdo to search args files for a pattern and replace it while suppressing errors and requiring confirmation.
:argdo %s/pattern/replace/gec | update
However, I would like to delete entire lines that contain the pattern. I use the following.
:argdo %/pattern/d | update
But I can't suppress errors or require confirmation. Is there a way to do this? Thanks!
(Also, is there a way to set "more" off? Thanks!)
© Super User or respective owner