7

I installed Termux and using the pkg system installed tmux.

However, the tmux that installs doesn't appear to support copying and pasting. I can enter copy mode, but I can't select text and copy it to the clipboard using the spacebar and the enter key. Is there any way to go about this?

1
  • This wasn't a problem for me. I was able to paste using Command + Shift + V in and outside tmux. I pasted my clipboard which was taken from other apps (eg Chrome) and also my macOS, via scrcpy. Apr 18, 2022 at 8:11

4 Answers 4

8

Try having this line in your ~/.tmux.conf file:

set-window-option -g mode-keys vi

This enables a set of vi key bindings that seems to work fine. I used the Spacebar and Enter keys to copy that line from within a tmux session running in Termux and pasted it into this textbox in Chrome with Ctrl+v.

2
  • 1
    Yes that did work! Nice work man. I believe I used CTRL+B, started my cursor with the h, j, k, and L keys pressed enter, and low and behold when I got to the address bar in Firefox I could paste it in!
    – leeand00
    Sep 7, 2018 at 18:38
  • Note, I may have used "+y as well....
    – leeand00
    Sep 7, 2018 at 18:38
6

Unfortunately, tmux can't access Android system clipboard, unlike real GNU/Linux distros. The copy mode is pretty much isolated in tmux, so you can only copy from and paste to within sessions.

To paste from clipboard, long-press (hold) anywhere on the terminal screen and tap "Paste" in the pop-up menu.

To copy to clipboard, long-press some text on the terminal screen. Drag the pins to select the text you want to copy and tap "Copy" in the pop-up menu.

5
  • I was only trying to access it within the session and copy it between panes and windows. Maybe I wasn't clear about that above.
    – leeand00
    Apr 1, 2018 at 9:11
  • if that's all you want to do, you can use files and redirect outputs accordingly.
    – gcb
    May 20, 2018 at 0:00
  • 1
    One unfortunate thing about this is that the Termux pop-up menu pins don't know anything about vertically split panes, understandably, so that requires workarounds if you're trying to copy anything spanning multiple lines.
    – Jacob Wan
    Sep 6, 2018 at 15:52
  • Correction: I meant it's a problem for text in horizontally split panes. I always get those terms mixed up. For some reason I keep wanting to think it refers to the orientation of the separator between the panes rather than the layout of the panes in relation to one another.
    – Jacob Wan
    Sep 6, 2018 at 16:14
  • @JacobWan tmux's pane splitting is a good feature, but I don't think it works well on a phone's small screen, so I only use windows but not panes on my phone. For tablets, I admit copying text from splitted screen is a problem.
    – iBug
    Sep 7, 2018 at 0:46
3

This answer may be irrelevant to your needs, but I arrived at your post while trying to solve a problem. Unlike with the x windows system, you don't need anything but Termux to paste text. Use "share" on the selected text, share to Termux, then enter a filename as prompted, and tap open folder.

1

In vim, go into input mode by pressing i and then use CTRL+ALT+v to paste.

Note: you can use specific keyboard apps or an external keyboard to gain access to CTRL and ALT keys.

2
  • 2
    Could you please include instructions on how to press crt-alt-V on a smartphone software keyboard?
    – Izzy
    Nov 12, 2021 at 19:14
  • With a physical keyboard I use the ctrl alt v. For virtual keyboard I use gboards(or Samsung keyboard if im using my tab) builtin keyboard clipboard manager and tap the text card for what I want to paste. Nov 13, 2021 at 21:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .