Created
November 11, 2010 09:45
-
-
Save gaving/672269 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if which pbpaste > /dev/null; then | |
| CLIPBOARD=pbpaste | |
| elif which getclip > /dev/null; then | |
| CLIPBOARD=getclip | |
| fi | |
| if [ -n "${CLIPBOARD+x}" ]; then | |
| # insert wget with clipbaord content | |
| paste-clipboard() { | |
| LBUFFER="$($CLIPBOARD)" | |
| } | |
| zle -N paste-clipboard | |
| bindkey "^Xv" paste-clipboard | |
| # insert wget with clipboard content | |
| wget-clipboard() { | |
| URL="$($CLIPBOARD)" | |
| URL_BASE_NAME=$(basename $URL) | |
| LBUFFER="nocorrect wget '$($CLIPBOARD)' -O $URL_BASE_NAME" | |
| } | |
| zle -N wget-clipboard | |
| bindkey "^Xw" wget-clipboard | |
| # build git clone command from clipboard | |
| git-clone-clipboard() { | |
| REPO_URL="$($CLIPBOARD)" | |
| REPO_BASE_NAME=${$(basename $REPO_URL)%.git} | |
| LBUFFER="nocorrect git clone $REPO_URL $REPO_BASE_NAME" | |
| } | |
| zle -N git-clone-clipboard | |
| bindkey "^Xg" git-clone-clipboard | |
| fi | |
| # git clone suffix | |
| git-clone-suffix() { git clone $1 ${$(basename $1)%.git} } | |
| alias -s 'git'='git-clone-suffix' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment