Using this link, i wrote custom function to yank text from x-clipboard to shell terminal on pressing C-y
. I see two issues here,
copy_line_from_x_clipboard () {
xsel -o
}
bind -x '"\C-y": copy_line_from_x_clipboard'
1) It adds shell prompt string, PS1 after pressing C-y
. I prefer this function to behave exactly like Ctrl - Shift -v
. Presently, it outputs,
CLIPBOARD_STUFF PS1$
2) It empties the system clipboard, after yanking the text first time. Second time, i press C-y
, no more contents are getting yanked.
READLINE_LINE
changes are reflected in terminal... the newREADLINE_LINE
is a concatenated version of old contents plus yanked stuff. In the answer, i see a third string${l:$n:$((${#l}-n))
. What does it do? – Aug 06 '15 at 05:16READLINE_LINE
is lengthy in the above answer butREADLINE_LINE=${l:0:$n}$s
does the work neatly as well..... – Aug 06 '15 at 11:04