Ada Programming $WikiTagline
 

Links/AdaCL Trace Remover and Restorer

When used together with the NERD Commenter this script will comment out all Links/AdaCL.Trace procedures or remove the comments in again.

[...PLUGIN]AdaCL.vim

 
"------------------------------------------------------------------------------
"
" Remove traces
" 
:function! <SID>AdaCL_Remove_Trace ()
    :%foldopen!
    :normal \ca
    :silent! %substitute /\v%(--)@<!(with AdaCL.Trace;)/--\1/
    :normal gg 
    :while search("   AdaCL.Trace", "W") > 0
        :execute "normal /\\VAdaCL.Trace\<CR>v/\\V);\<CR>" . g:mapleader .  "cc"
    :endwhile
    :normal \ca
:endfunction

"------------------------------------------------------------------------------
"
" Restore traces
" 
:function! <SID>AdaCL_Restore_Trace ()
    :%foldopen!
    :normal gg 
    :silent! %substitute /\v--(with AdaCL.Trace;)/\1/
    :normal gg 
    :while search("--Trace\.Put_Line", "W") > 0
        :normal h
        :execute "normal /\\V--AdaCL.Trace\<CR>v/\\V);\<CR>" . g:mapleader .  "cu"
    :endwhile
    :normal \ca
:endfunction

:command! AdaCLRemoveTrace  call <SID>AdaCL_Remove_Trace ()
:command! AdaCLRestoreTrace call <SID>AdaCL_Restore_Trace ()

:nnoremap <silent> <Leader>tm :AdaCLRemoveTrace<CR>
:nnoremap <silent> <Leader>ts :AdaCLRestoreTrace<CR>

:47nmenu <silent> Plugin.AdaCL.Remove\ Traces<Tab>\\tm  :AdaCLRemoveTrace<CR>
:47nmenu <silent> Plugin.AdaCL.Restore\ Traces<Tab>\\ts :AdaCLRestoreTrace<CR>

" vim: textwidth=0 tabstop=8 shiftwidth=4 softtabstop=4 expandtab:
 

© 2005 Martin Krischik, Content is available under GNU Free Documentation License.