I want to access the content of what I copied in the buffer with the vi-mode of the clipboard via the command ctrl + v or ctrl + shift + v in the terminal.
I copied in my .zshrc the following: (from this answer: Pasting from clipboard to vi-enabled zsh or bash shell)
vi-append-x-selection () { RBUFFER=$(xsel -o -p </dev/null)$RBUFFER; }
zle -N vi-append-x-selection
bindkey -a '^X' vi-append-x-selection
vi-yank-x-selection () { print -rn -- $CUTBUFFER | xsel -i -p; }
zle -N vi-yank-x-selection
bindkey -a '^Y' vi-yank-x-selection
When I highlight something in the terminal in vi-mode and yank it, I can successfully retrieve it by typing Ctrl + shift + y. However when I type Ctrl + shift + v, something else in being pasted.
When I inspect the content of the clipboard with the following commands:
xclip -o sel p
xclip -o sel s
xclip -o sel c
xsel -o -p
xsel -o -s
xsel -o -b
it contains other string that I peviously copied with other means but NOT what I highlighted in vi-mode.
Here is my first question: if I can retrieve it with the command Ctrl + shift + y and confirm that with xsel and xclip that it is not in one of the three buffer ("primary", "secondary" and "clipboard") where is stored then???)
I also tried to replace the '^Y' by '^V' in the line
bindkey -a '^Y' vi-yank-x-selection
(as follows:)
bindkey -a '^V' vi-yank-x-selection
Without any success (it seems to print out an empty buffer)
my second question: What am I doing wrong?