Commit Graph

110 Commits

Author SHA1 Message Date
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
dc24dea0de tmux: Highlight zoomed pane in status more
Additionally to underlining it, highlight it by using a yellow
background.
2024-03-21 15:53:38 +01:00
83945840b8 tmux: Rudimentary vim's text object simulation
Add non-robust emulation of vim's v_i{w,W,p,quote,'}.

TODO: Is there a better way of doing else-if?
2024-03-21 15:53:38 +01:00
8c33a9bf96 tmux: Update tmux-resurrect
With commit dd36a4561b0b ("use XDG_DATA_HOME for resurrect-dir path")
the default location of resurrect-dir changed to
$XDG_DATA_HOME/tmux/resurrect as long as $HOME/.tmux does not exist.
This makes manually hard-coding resurrect-dir obsolete.
2024-03-21 11:02:37 +01:00
3ec9dd6305 tmux: Place resurrect files in XDG_DATA_HOME
Unfortunately I need to hardcode XDG_DATA_HOME as resurrect-dir does not
support environment variables except for HOME and HOSTNAME.
2024-03-21 11:02:37 +01:00
45901f95df tmux: Better window dragging through swap-window 2024-02-29 13:00:16 +01:00
1d00e201a7 tmux: Support dragging into status bar
Additionally to dragging a window onto the target destination, add
support to drag it further than the outermost windows.
2024-02-28 16:07:31 +01:00
6d60e14824 tmux: Use move-window for window dragging
Use move-window for window dragging instead of a loop and swap-window.
When using -a or -b (i.e. after or before) the target can be occupied
and the windows are reordered automatically.
2024-02-28 16:07:31 +01:00
58297ce697 tmux: Place new window after the current one 2023-07-10 16:04:44 +02:00
f6c627bd53 tmux: Use hex values for colors
Taken from my st fork (Originally the tango theme I believe).
2023-06-27 18:20:38 +02:00
a2c27496eb tmux: Reorder windows by dragging on status line 2023-06-15 15:32:03 +02:00
6b3f72c27c tmux: Select last window if target is current 2023-06-15 13:47:31 +02:00
88e991f944 tmux: Add bindings to swap window with prev/next 2023-06-15 12:09:44 +02:00
6a36867d4d tmux: Select windows with Alt-[0-9] 2023-06-15 12:04:23 +02:00
b4eba71b16 tmux: C-v should start the selection if inactive 2023-06-14 12:24:08 +02:00
d4d29b0c64 tmux: Use e prefix when comparing numbers 2023-06-14 11:17:23 +02:00
998c1c3fda tmux: Better simulate vim's C-e & C-y
Keep the cursor position or selection while scrolling.
2023-06-14 10:58:07 +02:00
d85dd89416 tmux: Make selfinsert binding C-v repeatable 2023-06-07 11:58:58 +02:00
52963bf2be tmux: Mimic vim's Y in copy-mode-vi 2023-05-22 15:13:35 +02:00
6ec99f3af7 tmux: Emulate normal-mode y without selection
Try to mimic vim's normal and visual mode behaviour of `y`.

Set 'copy-command' for the copy-pipe commands to fall back to.
2023-05-22 15:12:59 +02:00
3944156168 tmux: Replace selfinsert.sh with a command-prompt 2023-05-22 14:47:48 +02:00
33be2cf3be tmux: Cancel copy-mode with insert-mode bindings 2023-05-22 14:47:13 +02:00
0bb92e80c8 tmux: Clean up some comments 2023-05-22 14:02:17 +02:00
cc299641e5 tmux: Remove code redundancy with hidden variable 2023-05-22 13:49:37 +02:00
1a9780925a tmux: Fix selfinsert key-table
Some keys were missing from the key-table (e.g. C-[hjkl]) as they were
set later in the config.

Fix by moving the script execution to the bottom of the config.
2023-05-22 13:24:30 +02:00
de001db473 tmux: Underline windows in status line when zoomed
I sometimes forget that windows are in zoomed state as I was missing a
visual indicator. Underline the window names in the status line to fix
that.

TODO: Move added code bit into a variable to prevent redundancy. I was
      not able to get it to be expanded, in contrast it would just
      insert the text literally.
2023-03-22 12:31:08 +01:00