Skip to content

Instantly share code, notes, and snippets.

@skriticos
Created August 13, 2010 06:10
Show Gist options
  • Save skriticos/522405 to your computer and use it in GitHub Desktop.
Save skriticos/522405 to your computer and use it in GitHub Desktop.
" 2010-08-11..2010-08-13
" Saves current buffer and executes it.
" If the buffer doesn't have a filename, it is stored in a temp location.
function! SF_run()
if bufname("%") == ""
let PATH = "/tmp/".localtime().".vim"
else
let PATH = bufname("%")
endif
exec ":write ".PATH
exec ":source ".PATH
endfunction
map <F8> :call SF_run()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment