Created
November 13, 2013 07:07
-
-
Save violetyk/7444938 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
function! s:Paste64Copy() range | |
let l:tmp = @@ | |
silent normal gvy | |
let l:selected = @@ | |
let b64 = webapi#base64#b64encode(l:selected) | |
if $TMUX != "" | |
"tmuxのとき | |
let cmd = printf('printf "\x1bPtmux;\x1b\x1b]52;;%s\x1b\x1b\\\\\x1b\\" > /dev/tty', b64) | |
" call system('printf "\x1bPtmux;\x1b\x1b]52;;%s\x1b\x1b\\\\\x1b\\" > /dev/tty') | |
elseif $TERM == "screen" | |
"GNU Screenのとき | |
let cmd = printf('printf "\x1bP\x1b]52;;%s\x07\x1b\\" > /dev/tty', b64) | |
" call system('printf "\x1bP\x1b]52;;%s\x07\x1b\\" `echo -en "' . l:escaped . '" | base64` > /dev/tty') | |
else | |
let cmd = printf('printf "\x1b]52;;%s\x1b\\" > /dev/tty', b64) | |
endif | |
call system(cmd) | |
redraw! | |
let @@ = l:tmp | |
endfunction | |
command! -range Paste64Copy :call s:Paste64Copy() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment