New answers tagged

1

In addition to the "solution/work-around" by Jeff Schaller , the proper solution seems to be to make the environment aware of copy-paste, both from sender side and from receiver side, which is known as "bracketed paste mode". From https://cirw.in/blog/bracketed-paste , here is a short snippet to explain a little more : In summary: Enable ...


2

This is not an answer, but maybe it's an acceptable work-around: alias p='perl; echo hit control-d again; cat > /dev/null' Then, if your perl script exits prematurely, you'll harmlessly paste the remainder to /dev/null; if the perl script succeeds, you'll see your friendly reminder and hit control-d to exit the cat catcher.


1

Ok, figured it out, I could just manipulate the different buffers directly: x-paste() { PASTE=$(pbpaste) LBUFFER="$LBUFFER${RBUFFER:0:1}" RBUFFER="$PASTE${RBUFFER:1:${#RBUFFER}}" } zle -N x-paste bindkey -M vicmd "p" x-paste


1

zsh keeps the position of the cursor in the variable CURSOR so: paste-from-clipboard () { CLIPOUT=`xclip -o` BUFFER=$LBUFFER$CLIPOUT$RBUFFER CURSOR=$(( $CURSOR + ${#CLIPOUT} )) }


4

The clipboard is not stored in the filesystem or even in a particular location in memory. In fact, there is no such thing as "the" clipboard; copy/paste is implemented via a communications protocol between applications. When you copy text in an application (whether by selecting text, for the primary selection, or by an explicit 'copy' operation for ...


0

Use file redirection to save standard out to a temporary file such as /tmp/o $ script.sh > /tmp/o Open browser such as Firefox/Iceweasel, to address: /tmp/o Now select all, copy and paste to Pastebin.org


1

You can use the tools xsel or xclip to translate from X clipboard to stdin/stdout on a terminal. If these aren't installed, they're usually available through your distro's package manager. See the man page for the relevant tool to get details on invocation.


2

In X, there will be one application which owns the current selection, which usually (but not always) is visible. When you paste into an X client, that application asks the X server for the selection data, and the request is referred to the selection owner, who provides the information. The selection owner may be capable of providing the selection data in ...


0

I'm not sure but looks like you are talking about cut buffers. For more info how clipboard and cut buffers works check out this links: freedesktop clipboards short spec, Inter-Client Communication Conventions Manual X Selections, Cut Buffers, and Kill Rings. Happy digging!


0

With a configurable window manager like dwm, openbox or many others, you can run this snippet xclip -selection clipboard while pressing Super + C to copy and a similar script in the editor (vim, emacs, etc.) can retrieve the selection and insert it at point.



Top 50 recent answers are included