mh21 / errormarker.vim

Highlights and sets error markers for lines with compile errors
http://www.vim.org/scripts/script.php?script_id=1861
31 stars 3 forks source link

Support a command to remove all the signs. #4

Closed skywind3000 closed 7 years ago

skywind3000 commented 7 years ago

support a command to remove all the signs which are belong to errormarker.vim: I have to use this script in my vimrc to get signs removed:

function! s:GuiSignRemove(...)
    if a:0 == 0 | return | endif
    redir => x
    silent sign place
    redir END
    let lines = split(x, '\n')
    for line in lines
        if line =~ '^\s*line=\d*\s*id=\d*\s*name='
            let name = matchstr(line, '^\s*line=.*name=\zs\w*')
            let id = matchstr(line, '^\s*line=\d*\s*id=\zs\w*')
            for x in range(a:0)
                if name == a:{x + 1}
                    silent exec 'sign unplace '.id
                endif
            endfor
        endif
    endfor
endfunc

command! -nargs=+ GuiSignRemove call s:GuiSignRemove(<f-args>)
noremap <silent><space>rm :GuiSignRemove errormarker_error errormarker_warning<cr>

could you please provide something like that directly in errormarker.vim ? Some times when I am working on some old ugly .c file which is full of warnings or errors on modern compiler, I just want to tell errormarker: "thank you, I got it, could you please dissapear for a while, I want to refact this whole part of the source file, and the signs just get me distracted"

mh21 commented 7 years ago

Thanks for the suggestion! I pushed a shorter version of the command as 66ab8e0a356ea8a971e99156c59d09c3beae5ef2, I hope that works for you.

skywind3000 commented 7 years ago

It just works ! The tedious code could be removed now in my vimrc, thanks.

skywind3000 commented 7 years ago

Welcome to use my plugin: asyncrun It now can cooperate with errormarker very well.