Solved XTerm copy/paste to system clipboard

I've read numerous guides on doing copy/paste between XTerm (or Tmux) and the system clipboard but just can't get the hang of it.

Can anyone help.

Using LXTerminal handles copy/paste without much trouble.
 
Left mouse button selects, middle mouse button pastes. Tmux might capture mouse input though, use shift mouse button there.

Many thanks!

I misunderstood how to select... I thought the selected area would remain marked after selection, but it became unmarked when I released left mouse button, so thought it hadn't been selected. I didn't realised it was so simple.
 
I didn't realised it was so simple.
It takes some time getting used to it, especially if you're more accustomed to MS Windows. Can't really use CTRL-C, CTRL-V as these have a different meaning in the shell.
 
Ctrl + Shift + c/v not working? What's the matter?

Xterm doesn't support the clipboard (except for automatically copying to it with above config option, but even then it doesn't have keystrokes for it).

It is important to understand the difference between the X selection and the clipboard when you use xterm (or generally).
 
heres how to copy and paste in tmux

first its a good idea to change the tmux prefix key to something like ctrl a

add the following to your ~/.config/tmux/tmux.conf

Code:
# Change the prefix key to C-a
set -g prefix C-a
unbind C-b
bind C-a send-prefix

setw -g mode-keys vi
bind-key Escape copy-mode            # enter copy mode; default [
bind-key p paste-buffer                # paste; (default hotkey: ] )

# Note: rectangle-toggle (aka Visual Block Mode) > hit v then C-v to trigger it
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi V send-keys -X select-line
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T choice-mode-vi h send-keys -X tree-collapse
bind-key -T choice-mode-vi l send-keys -X tree-expand
bind-key -T choice-mode-vi H send-keys -X tree-collapse-all
bind-key -T choice-mode-vi L send-keys -X tree-expand-all
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "wl-copy && wl-paste -n | wl-copy -p"
bind-key p run "wl-paste -n | tmux load-buffer - ; tmux paste-buffer"

then to enter copy mode press ctrl + a
release the keys and then press [

you are now in copy mode and you can use the vim keys to move up and down

press v and then press l to select text forward and if you go to far press h to deselect the text
press j to select the next line down and k to go up

then press y to yank the selected text to the clipboard
and press q to quit

you can paste using shift + ctrl +v
when you arent in copy mode

tmux config
 
Back
Top