Advertisement
tonybaldwin

poor attempt at vim+pastebin plugin...

Jun 19th, 2011
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.06 KB | None | 0 0
  1. " Vim plugin to paste stuff to pastebin.com
  2. " Last change: 2011 JUN 19
  3. " Maintainer: Tony Baldwin <tony@baldwinsoftware.com
  4. " License: © tony baldwin, released according to the terms of the GPL v. 3
  5. " Make sure we gots us some bashy goodness...
  6.  
  7. if !has("bash")
  8.  finish
  9. endif
  10.  
  11. " I map this to f11, so you may want to change that if you have f11 doing something else.
  12. :vmap <f11> :PasteIt<cr>
  13. " define a command
  14. :command -range -nargs=* PasteIt :call PasteMe(<line1>,<line2>)
  15.  
  16. function! PasteMe(line1,line2,args)
  17.       let sel_save = &selection
  18.       let &selection = "inclusive"
  19.      
  20.       let pc = sel_save
  21. " change this to your username
  22.       let un = tonybaldwin
  23. " make this your password
  24.       let pw = **********
  25.       let uk=$(: !curl -d api_dev_key="useyourkey" -d api_user_name="$un" -d api_user_password="$pw" http://pastebin.com/api/api_login.php)
  26.  
  27.       : !curl -d api_dev_key="useyourkey" -d api_user_key="$uk" -d api_user_name="$un" -d api_user_password="$pw" -d api_option="paste" -d api_paste_code="$pc" http://pastebin.com/api/api_post.php
  28. fi
  29.  
  30. endfunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement