Skip to content

Instantly share code, notes, and snippets.

@zph
Created January 5, 2013 05:41
Show Gist options
  • Save zph/4459982 to your computer and use it in GitHub Desktop.
Save zph/4459982 to your computer and use it in GitHub Desktop.
" plain annotations
map <silent> <F10> !xmpfilter -a<cr>
nmap <silent> <F10> V<F10>
imap <silent> <F10> <ESC><F10>a
" Test::Unit assertions; use -s to generate RSpec expectations instead
map <silent> <S-F10> !xmpfilter -u<cr>
nmap <silent> <S-F10> V<S-F10>
imap <silent> <S-F10> <ESC><S-F10>a
" Annotate the full buffer
" I actually prefer ggVG to %; it's a sort of poor man's visual bell
nmap <silent> <F11> mzggVG!xmpfilter -a<cr>'z
imap <silent> <F11> <ESC><F11>
" assertions
nmap <silent> <S-F11> mzggVG!xmpfilter -u<cr>'z
imap <silent> <S-F11> <ESC><S-F11>a
" Add # => markers
vmap <silent> <F12> !xmpfilter -m<cr>
nmap <silent> <F12> V<F12>
imap <silent> <F12> <ESC><F12>a
" Remove # => markers
vmap <silent> <S-F12> ms:call RemoveRubyEval()<CR>
nmap <silent> <S-F12> V<S-F12>
imap <silent> <S-F12> <ESC><S-F12>a
function! RemoveRubyEval() range
let begv = a:firstline
let endv = a:lastline
normal Hmt
set lz
execute ":" . begv . "," . endv . 's/\s*# \(=>\|!!\).*$//e'
normal 'tzt`s
set nolz
redraw
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment