Created
June 21, 2017 13:23
-
-
Save RobertDober/8e1ee67024cb23fc2ac3a3026d49f58d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! lab42#buffer#gist(line1, line2, ...) | |
let l:lines = getline(a:line1, a:line2) | |
if a:0 | |
let l:basename = a:1 | |
else | |
let l:basename = expand("%:t") | |
endif | |
let l:gistfile = '/tmp/' . l:basename | |
call writefile(l:lines, l:gistfile) | |
let l:result = system('gist ' . l:gistfile) | |
call system('open ' . l:result) | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment