Hmm, I've had a look at the help files for bash's
bind
builtin.
e.g.
Which lists various parameters that will show you which functions are available and what keys they are bound to.
I had a bit of a play with some of the options, to see if I could get anything working.
Had no luck so far. However, a quick bit of duckduckgo-fu yielded this:
tldr: Does anyone know how to configure what buffer is used by vi-mode bash for yanking (copying) and pasting? Long version: I have set editing-mode vi in my .inputrc, so that programs using the re...
unix.stackexchange.com
Which looks like it might be an acceptable solution to your problem.
Personally, when I'm working in the terminal, I'm usually working inside a tmux session, so I use the tmux-yank plugin, which allows me to copy/paste to/from the system buffer.
I have
<C-a>
(Ctrl+a) set as my leader key in tmux (instead of the default
<C-b>
).
So to enter tmux's text selection mode, I use
<C-a>{
to enter text navigation mode. I have tmux set to use vi keybinds, but there are a few anomalous ones. Like using
<space>
to go into selection mode and start selecting a block of text, but the movement keys are still vim ones (h,j,k,l) and I yank to the global system buffer using
y
.
And to paste, I use tmux's paste keybind, which is
<C-a>}
.
For any tmux users reading this, the tmux-yank plugin can be found on github here:
Tmux plugin for copying to system clipboard. Works on OSX, Linux and Cygwin. - tmux-plugins/tmux-yank
github.com
Clone it locally on your PC, to wherever you want using:
Bash:
git clone https://github.com/tmux-plugins/tmux-yank.git
Then to use it, simply source it in your .tmux.conf.
e.g. add the following line:
Bash:
source /path/to/tmux-yank/yank.tmux
Where
/path/to/tmux-yank/
is the path where you cloned the tmux-yank to.
To update the plugin, all you have to do is periodically run:
Then the next time you run tmux, the latest version of the plugin will be loaded.