stardiviner
9/7/2012 - 3:24 AM

vimrc

            " range
            function! VimLRangeSource() range
                let tmpsofile = tempname()
                call writefile(getline(a:firstline, a:lastline), l:tmpsofile)
                execute "source " . l:tmpsofile
                call delete(l:tmpsofile)
            endfunction

            " visual
            " V -> "ay -> :@a

            command! -range VimL <line1>,<line2>call VimLRangeSource()
            au FileType vim vnoremap <silent><buffer> <F5> <esc>:'<,'>:VimL<cr>

            " file
            " au FileType vim nnoremap <F5> :source %<cr>
            au FileType vim nnoremap <silent><buffer> <F5> :exec 'source ' . bufname('%')<CR>