Skip to content

Instantly share code, notes, and snippets.

@eduardoarandah
Created December 12, 2020 03:06
Show Gist options
  • Save eduardoarandah/5f1f83e705d1a015b58bcae21172aab5 to your computer and use it in GitHub Desktop.
Save eduardoarandah/5f1f83e705d1a015b58bcae21172aab5 to your computer and use it in GitHub Desktop.
Vim plugin share code pastebin
"""""""""""""""""""""""""""""""""""
" Share via paste.rs
"
" Visual select and :Share
"
" Add .extension to url to format code
" Example: .markdown
"""""""""""""""""""""""""""""""""
function! s:share() range
let n = @n
silent! normal gv"ny
let out = system("echo '" . @n . "' | curl --silent --data-binary @- https://paste.rs")
let @n = n
normal `>
put =''
put ='Share:'
put =out
" also copy to clipboard?
let @+ = out
endfunction
command! -range Share :call s:share()<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment