plugin di vim per salvarsi dalla noia

Plugin per incrementare il serial in un file di zona di Bind:

root@dumbo:/etc/bind# cat ~/.vim/plugin/Soa.vim
function! INCSERIAL(date, num)
        if (strftime("%Y%m%d") == a:date)
                return a:date . a:num+1
        endif
        return strftime("%Y%m%d") . ‘01′
endfunction

command SER :%s/\(2[0-9]\{7}\)\([0-9]\{2}\)\s*;\s*Serial/\=INCSERIAL(submatch(1), submatch(2)) . ‘     ; Serial’/gc

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)