Skip to content

Instantly share code, notes, and snippets.

@joelrdzdio
Forked from eduardoarandah/.vimrc
Created January 3, 2022 19:47
Show Gist options
  • Save joelrdzdio/6558d846289bd621e88a8f7fee789bd6 to your computer and use it in GitHub Desktop.
Save joelrdzdio/6558d846289bd621e88a8f7fee789bd6 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