Commit Graph

135 Commits

Author SHA1 Message Date
fced504674 tmux: Kill dead pane with Escape too 2025-09-03 10:07:53 +02:00
59863b28b3 tmux: Fix scrolling down in alternate mode
Scrolling down with the mouse wheel in alternate mode (e.g. less)
stopped working for me. I'm pretty sure that this used to work, but tmux
never had a default binding for WheelDownPane, so I'm unsure from where
this change should have come from ¯\_(ツ)_/¯
2025-08-06 11:38:24 +02:00
071c2866e5 tmux:yank: Copy also in view-mode 2025-03-24 18:36:41 +01:00
a396df8cea tmux: Fix window reordering >3.4 2025-03-24 18:36:40 +01:00
597f86b4fd tmux: Reorder MouseDragEnd1StatusDefault blocks 2025-03-24 18:36:40 +01:00
0810a83c0b tmux: Bind MouseDragEnd1StatusDefault w/o run-shell
The special token `$` indicates the highest-numbered window. Also switch
to using before `^` when moving to the front for consistency.
2025-03-24 18:36:40 +01:00
0c8d1f4292 tmux: Put some parts in version >= 3.3 checks
Ubuntu 22.04 is shipped with 3.2a... There might be more issues with
that version, but these were the ones I could find for now.

Tmux commits needed:
- c03b57465bdf/866117636e47 ("Add different command historys for
  different types of prompts ("command", "search" etc). From Anindya
  Mukherjee.") for `prompt-history-limit`
- e06a4e041c68 ("Set mouse_x and mouse_y on the status line, GitHub
  issue 2913.") for mouse_x in MouseDragEnd1StatusDefault binding
- 9f6164a05cc0 ("Make send-keys without any arguments send the key it is
  bound to (if any). GitHub issue 2904.") for `C-d`, `Enter` bindings
2025-03-13 14:33:26 +01:00
cd930fc9e8 tmux: Fix pane <-> window confusion in comment 2025-01-29 17:12:28 +01:00
6ff2aa3527 tmux: Cycle windows with Alt-Page{Up,Down}
Also change the only other use of PPage (i.e. PageUp) to PgUp. PageUp
and PageDown would probably be nicest, but I like that PgUp and PgDn are
of equal length. I dislike NPage and PPage.
2025-01-29 17:12:28 +01:00
c093a4ea37 tmux: Select last window with prefix+[0-9] too
This is already the case with M-[0-9].

prefix+0 was also still selecting window 0.
2025-01-22 14:54:29 +01:00
1d86941a07 tmux: Remove unneeded semicolon 2024-11-06 13:33:54 +01:00
79977eb81f tmux: Unbind <prefix> + arrow keys
I don't use them.
2024-10-21 17:14:17 +02:00
92289052ca tmux: Make <prefix>[hjkl] not repeatable
This is more than often annoying. For example when switching from a fzf
pane to a vim pane (i.e. needing these bindings instead of `C-[hjkl]`)
and then trying to move the cursor.

Reverts: 048933e67d ("tmux: Make `<prefix>[hjkl]` bindings repeatable")
2024-10-21 17:14:17 +02:00
91be5135eb tmux: Remove completed TODO
Fixed: 7dcd00058f ("tmux:TODO: Do not modify selection when
scrolling")
Fixed-by: aa901099b0 ("tmux: Use C-[ey] for scrolling with the wheel")
2024-10-18 16:13:35 +02:00
3e9dcaff9d tmux: Paste primary selection with middle mouse
Similar to everywhere else, paste the primary X selection (XA_PRIMARY)
instead of the most recent tmux paste buffer.

TODO: Forward event to 'root' key-table to prevent code duplication
2024-10-18 16:13:35 +02:00
012d913901 tmux: Get rid of "Not in a mode" error
The copy command should only be executed when not in a mode (i.e.
alternate?). This gets rid of the error message "Not in a mode" when
double/triple clicking inside of vim etc..
2024-10-18 16:13:35 +02:00
37cb526728 tmux: Unbind default DoubleClick bindings
When switching to the 'SecondClick' event in 4b8e877305 ("tmux: Use
SecondClick instead of DoubleClick event"), I forgot to add an `unbind`
of the default binding that was previously overwritten. Since I just
resourced my config I didn't notice.
2024-10-18 16:13:35 +02:00
aa901099b0 tmux: Use C-[ey] for scrolling with the wheel 2024-10-14 09:38:41 +02:00
9bc59bec72 tmux: Use 1-based indices for panes too 2024-10-07 13:23:14 +02:00
c273c3ac52 tmux: Manually "backport" scroll-middle if missing
First working draft
2024-09-18 16:30:45 +02:00
f5673c2082 tmux: Respawn dead pane on Enter 2024-09-18 15:16:41 +02:00
c6b317f794 tmux: Fix C-e & C-y bindings
Apparently I broke them in commit 4e8ab80c66 ("tmux: Fix edge cases
in paragraph text-object") by adding the comments. Through them the
bindings were not set in place since the binding stopped with the
comment (I guess?). Weirdly I do not get an error message and the
default bindings stay, so I am not sure what exactly happens. This could
also be due to a version change from 3.3a to 3.4.

Fix the bindings by starting a code block instead of just escaping the
newline.

Do this also everywhere else to prevent errors in the future.
2024-09-15 22:44:52 +02:00
29e6b46135 tmux:textobjs:TODO: Merge all get_var calls
I want to minimize the needed calls to `tmux` to 2.
2024-09-04 16:38:52 +02:00
ec417a439c tmux:textobjs: Merge all copy-mode commands
`copy_exec` was stupid since it brought unnecessary shell overhead even
though it was meant to improve performance (one could argue that it is
not even necessary here).

Continue the idea of reducing calls to `tmux` by "globally" chaining
together all copy-mode commands instead of doing it only "locally" with
`copy_exec`. This has the added benefit that also calls having arguments
can be included and merged.
2024-09-04 16:38:52 +02:00
882ce0de93 tmux:textobjs: Reduce calls to tmux
Put multiple commands together in one tmux call instead of calling it
every time.
2024-09-04 16:38:52 +02:00
267814f075 tmux:textobjs: Fix faulty UTF-8 handling by cut 2024-09-04 08:00:40 +02:00
7e25fed27c tmux:textobjs: Implement more objects (`,[,(,<,{) 2024-09-04 08:00:40 +02:00
cab360ecf7 tmux: Require confirmation before killing a pane
It happened to me multiple times that I closed a pane without actually
wanting it via a (too) quick <C-d>.

Activate remain-on-exit so that I have to press <C-d> twice before the
pane is actually killed. Dead panes can be recovered with
`respawn-pane`.

Will see how this goes - could be annoying.
2024-08-30 18:14:20 +02:00
48536921d7 tmux:textobjs:TODO: Fix non-ASCII characters 2024-08-30 18:14:19 +02:00
1e4934989b tmux:textobjs: Do nothing when sitting on a space
When the cursor sits on a space character on `iw`, vim does nothing.
2024-08-30 18:14:19 +02:00
c106639a30 tmux:textobjs: Fix word & WORD edge cases 2024-08-30 18:14:19 +02:00
9d0631e858 tmux: Copy multi-click selection into primary
Also split the MouseDragEnd1Pane binding so that the full xclip
arguments can be written out to stay consistent.
2024-08-26 12:12:14 +02:00
4b8e877305 tmux: Use SecondClick instead of DoubleClick event
Make the word selection instant by changing the mouse event. If a third
click follows, the selection just changes to the full line.
2024-08-26 12:12:14 +02:00
faee7ea2ea tmux: Reorder prefix setting to top of bindings 2024-08-26 12:02:57 +02:00
41360b8278 tmux: Group options setting 2024-08-26 12:02:57 +02:00
873021ba80 tmux: Do not copy-and-cancel after a multi click
If I select a word or line with a double or triple click, I want it to
stay selected.
2024-08-26 12:02:50 +02:00
120285c478 tmux:textobjs: Do not use scroll_region
scroll_region_{upper,lower} are only modified by the DECSTBM escape
sequence:

> This control function sets the top and bottom margins for the current
> page. You cannot perform scrolling outside the margins.

And are 0 and pane_height - 1 otherwise. Tmux implements these such that
command output can't be displayed outside these margins, but the cursor
in copy-mode can. This means that using them to check if the cursor is
at the very top or bottom can break in certain situation (even those
seem extremely rare since I have never heard of this escape sequence).

Get rid of them and just use 0 and the pane height.

[1]: https://vt100.net/docs/vt510-rm/DECSTBM.html
2024-07-05 14:26:05 +02:00
7565ae2f6f tmux: Move textobj simulation into own textobjs.sh 2024-07-05 14:26:04 +02:00
4e8ab80c66 tmux: Fix edge cases in paragraph text-object
Also add comments explaining the history & pane position checks in the
C-y and C-e bindings, since I used those and had to rethink about what
they're doing.
2024-07-05 14:26:04 +02:00
b0b0a2ebea tmux: Formatting: Break long if-statements 2024-07-04 14:46:59 +02:00
e04953c123 tmux:yank: Add note about text object simulation 2024-07-04 14:46:58 +02:00
ec637ad1c8 tmux: Support repeatable yank motions via yank.sh
Implementing logic inside tmux's config starts to become tedious with
growing complexity. Introduce a shell script that handles the logic of
the (now also repeatable) vim-like bindings.
2024-07-04 14:46:58 +02:00
91d34358ec tmux: Use %1 instead of %%
According to the manpage all occurrences of `%1` are replaced, but only
the first of `%%`. The binding also worked with `%%`, but better stick
to the docs.
2024-07-04 14:46:58 +02:00
4f5d853823 tmux: Support yy in copy-mode-vi 2024-07-04 11:46:43 +02:00
c3ae99aa94 tmux: Fix broken target window flag
tmux stopped supporting format strings for the -t flag
2024-05-29 14:34:47 +02:00
2fabe6dd4c tmux: Add notes to some bindings
This has the benefit that these bindings now show up in the output of
`list-keys -N` (bound to `<C-a>?`).
2024-05-02 11:21:49 +02:00
0b89388db0 tmux: Bind <C-o> to focus last-window 2024-05-02 11:21:49 +02:00
4251fec30e tmux: Change <C-a>! to place behind current window
Analog to <C-a>c the new window should be placed behind the current one.
2024-04-18 08:35:19 +02:00
4b8ab18392 tmux: Fix MouseDragEnd1StatusDefault for v3.4
move-window does not support format parsing. Apparently it was a bug
that it did in the past. Fix this by using run-shell - which I hate as a
solution.
2024-03-24 16:07:12 +01:00
48acd729fe tmux: Do not enter copy-mode with Escape
I rarely use this binding as by now I have the muscle memory of `<C-a>[`
to enter copy-mode and since my brain thinks that I can press Escape if
I accidentally press the prefix and I get disappointed every time.
2024-03-22 10:09:16 +01:00