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
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.
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.
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.
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.
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.
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.
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.
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.
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.
This reverts commit b4cbd08d3b.
I am not sure why I thought this was irrelevant. But when testing I did
not properly unset it or restart the server, so nothing changed when I
reloaded tmux.conf.
Conflicts:
.config/tmux/tmux.conf