Ways of selecting text without mouse to copy/paste?

Asked by Dave

I'm just wondering if there is a way of selecting text using only the keyboard to then copy and paste with copy/paste keybinds?

It would be a very useful feature. I don't use the mouse at all in a terminal if I can help it.

Question information

Language:
English Edit question
Status:
Solved
For:
Terminator Edit question
Assignee:
No assignee Edit question
Solved by:
Dave
Solved:
Last query:
Last reply:
Revision history for this message
Dave (dave-unrealize) said :
#1

Well I found a way to use xsel to copy to clipboard, then you can use Terminator's paste keybind.

This is the page that I found the solution on

https://stackoverflow.com/questions/16111548/how-to-copy-the-gnu-screen-copy-buffer-to-clipboard#16286619

Answer No 7 says to use this line in your .screenrc:

bindkey -m ' ' eval 'stuff \040' 'writebuf' 'exec sh -c "/usr/bin/pbcopy < /tmp/screen-exchange"'

I couldn't get pbdopy to build/install so I used xsel instead:

bindkey -m ' ' eval 'stuff \040' 'writebuf' 'exec sh -c "xsel -b < /tmp/screen-exchange"'

So now you can enter copy mode, move to the start of the lines that you want to copy, make the first mark with space, move to the end of the selection, make the second mark with space. At this point the screen buffer has been copied into the xclipboard.

Solved.