Useful tool indeed, thanks for sharing. I use clipper[1], which delivers a similar function through a different implementation. What I like about that one is that with right config you can also pipe output from remote servers back into your machine's clipboard, which is quite handy in so many situations. [1] https://github.com/wincent/clipper
There's a better way to do it. Terminals have a special escape sequence called OSC 52, which allows you to insert into the clipboard from even remote SSH sessions. Try this: printf "\033]52;c;$(printf "%s" "blabla" | base64)\a"
Yank: Yank Terminal Output to Clipboard
51–57 of 57 posts
Re: Yank: Yank Terminal Output to Clipboard
#52Useful tool indeed, thanks for sharing. I use clipper[1], which delivers a similar function through a different implementation. What I like about that one is that with right config you can also pipe output from remote servers back into your machine's clipboard, which is quite handy in so many situations. [1] https://github.com/wincent/clipper
There's a better way to do it. Terminals have a special escape sequence called OSC 52, which allows you to insert into the clipboard from even remote SSH sessions. Try this: printf "\033]52;c;$(printf "%s" "blabla" | base64)\a"
I have also considered trawling through the various terminal emulator source repos in order to know which are actually implemented (since that can for sure be a different set from those which are specified)
Re: Yank: Yank Terminal Output to Clipboard
#53You can do this with tmux too. ~/.tmux.conf: # export to clipboard. bind-key > run-shell -b 'tmux save-buffer - | xclip' # paste from clipboard. bind-key (edit: my actual setup is slightly different. It interacts with a Windows clipboard via ssh where the terminal is running. cf. https://github.com/euske/pyrexecd/blob/master/tools/tmux.con... )
Re: Yank: Yank Terminal Output to Clipboard
#54Re: Yank: Yank Terminal Output to Clipboard
#55On Mac OS, a much less powerful but built in tool is `pbcopy`.
To replicate pbcoby on X11 systems, add to your bashrc: alias clip="xclip -selection clipboard" `echo hello | clip` will copy 'hello' to the clipboard, and similarly `ls | clip` will copy a bunch of lines to the clipboard. You might need to install xclip through your package manger (the package is just named xclip on Arch).
if [[ "$(uname)" == "Linux" ]]; then
if ! grep -q Microsoft /proc/version; then
alias pbcopy='xsel --clipboard --input'
alias pbpaste='xsel --clipboard --output'
else
alias pbcopy='clip.exe'
alias pbpaste='powershell.exe -command "Get-Clipboard"'
fi
fiRe: Yank: Yank Terminal Output to Clipboard
#56The final example `yank -- xsel -b` is probably the most directly useful for me, but it still doesn't solve the following problem which irritates me to all hell: $ git push fatal: The current branch new has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin new Is there any sane way to copy the perfectly formatted `git push -u` command shown above without…
I think “thefuck” handles this case really well: https://github.com/nvbn/thefuck
Re: Yank: Yank Terminal Output to Clipboard
#57I've been using ubuntu for over a decade and I have no idea how the clipboard works. There seems to be multiple clipboards and I have no idea when I am using which. I generally spam some combination of ctrl-v, shift-insert, rightclick context menu paste, middleclick, etc until I get what I want. I've abandoned vim for a gui solely because I have no idea how to copy stuff to/from it. Can someone finally explain it to…