Created
September 9, 2011 16:26
-
-
Save jlongster/1206667 to your computer and use it in GitHub Desktop.
ZLE widget for pasting on OSX
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
#!/bin/zsh | |
# Implements pasting at the terminal level on OS X | |
function mac_paste () { | |
left=$BUFFER[0,CURSOR] | |
right=$BUFFER[$((CURSOR+1)),${#BUFFER}] | |
content=`pbpaste` | |
BUFFER="$left$content$right" | |
CURSOR=$((${#left}+${#content})) | |
} | |
zle -N mac_paste | |
bindkey "v" mac_paste |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment