aboutsummaryrefslogtreecommitdiff
path: root/assets/outbox/2026-05-18-handoff-from-dotemacs-tmux-copy-mode-keys.org
blob: c3e46b46d6c4f27eeffe1ccd8910713126fff0b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#+TITLE: tmux copy-mode keys aligned with Emacs vterm-copy-mode
#+DATE: 2026-05-18

* Source

Authored from a =~/.emacs.d= session. Edit lives in this repo because
=~/.tmux.conf= is the stowed symlink target.

* Change

Added a copy-mode key block to =dotfiles/common/.tmux.conf= (just below
=set -g status-keys emacs=) to mirror the Emacs
=cj/vterm-tmux-history= / =vterm-copy-mode= ergonomics in
=~/.emacs.d/modules/vterm-config.el=:

#+begin_src tmux
bind-key -T copy-mode M-w  send-keys -X copy-selection
bind-key -T copy-mode C-g  send-keys -X cancel
unbind-key -T copy-mode Enter
#+end_src

Behavior:

- =M-w= copies the selection and stays in copy-mode, so multiple
  selections can be grabbed in a row. tmux's default copied and then
  exited via =copy-selection-and-cancel=.
- =C-g= now exits copy-mode (tmux's default was =clear-selection=).
- =Enter= is unbound so RET has no "copy and exit" shortcut. The
  Emacs side removes RET from =vterm-copy-mode-map= for the same
  reason — one consistent way to leave the buffer.

Defaults retained:
- =q= and =Escape= already cancel.
- =Space= still begins selection.

* Why

The Emacs side already aligned =vterm-copy-mode= and
=cj/vterm-tmux-history= on one key story (commentary block at the top
of =modules/vterm-config.el=). When tmux runs inside vterm, the user
also lands in tmux's copy-mode (via the auto-enter on mouse wheel-up,
line 10), so without this change the third surface had a different
key story — Enter exits, M-w exits, C-g clears rather than cancels.

* Activation

After pulling and re-stowing on each machine:

#+begin_src bash
tmux source-file ~/.tmux.conf
#+end_src

Or in a live tmux session: =prefix r= (configured at line 53 of the
conf).

* Status

Edited and saved. Not yet committed in =archsetup=. Craig confirms
the keys work, then commits at his discretion.