Skip to content

Instantly share code, notes, and snippets.

@davidbegin
Created March 13, 2020 16:07
Show Gist options
  • Save davidbegin/cf2dc40481b543ac4aac7232a02b7286 to your computer and use it in GitHub Desktop.
Save davidbegin/cf2dc40481b543ac4aac7232a02b7286 to your computer and use it in GitHub Desktop.
:vnoremap <leader>gi :<c-u>call <SID>GistAndPost(visualmode())<cr>
:nnoremap <leader>gi :call <SID>GistAndPost(mode())<cr>
function! s:GistAndPost(type)
if a:type ==# 'V'
let l:lines = getline("'<", "'>")
else
let l:lines = getline('^', '$')
endif
echom string(l:lines)
let l:uri = system('gist', l:lines)
let s:chat=system('beginbot ' . l:uri . ' ')
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment