" A VIM dancing doll! function! Dance() if &modifiable " This variable decides if the main loop is running let l:runme = 1 " Set a mark for us to get back to the line user " was working on mark L " The main loop while l:runme " Invert the case normal Hg~L redraw " If the user hit a char, then we ought to get out if l:runme && getchar(1) let l:runme = 0 endif " If we are still running: " Sleep a sec to give the feel of animation if l:runme sleep 1 endif " Undo the reverse-case normal u redraw if l:runme && getchar(1) let l:runme = 0 endif if l:runme sleep 1 endif endwhile " Get rid of the "modidfied # lines" kind of message echo '' " Move to the mark, the line user was editing normal 'L " Not modifiable, Cant run Dance.. else echo 'Can run Dance only on modifiable buffers' endif endfunction " Command to call the function command! Dance call Dance() " Key map to call the function nmap sv :call Dance()