Skip to content

Instantly share code, notes, and snippets.

@yesmeck
Created March 19, 2012 02:54
Show Gist options
  • Save yesmeck/2091981 to your computer and use it in GitHub Desktop.
Save yesmeck/2091981 to your computer and use it in GitHub Desktop.
CLI Pastebin within VimEnergy
#!/usr/bin/env bash
#
# Usage:
#
# ./pastbin.sh FILE
#
file=$1
ext=$(echo $file | grep -oP '\..{2,3}' | grep -oP '[a-z]+')
result=$(cat $file | curl -sF 'vimcn=<-' http://p.vim-cn.com)
if [[ $ext ]]; then
url=${result}?${ext}
else
url=$result
fi
echo $url
echo $url | xclip -selection clipboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment