Tmux without a config file challenge
====================================

Mimicking GNU Screen
--------------------
Like many other old geezers, I had at least ten years of GNU
Screen under my belt, before moving to tmux.

And, like most people at the time, to make the transition
easier, the first thing I did was to set the prefix key from
the default Ctrl-B to Ctrl-A, like I was used in GNU Screen.

One thing leads to another, and before you know it, you have a
tmux.conf which configures vi-like key-bindings for copy and
paste, set the color of your status line, and much more. Most
example configs I have seen on the internet, have this
configuration.

Prefix
------
Folklore tells us, that the choice of the prefix of
tmux, "Ctrl-B", has two reasons:

* tmux was developed in GNU Screen, so the prefix had
 to be different from the prefix of GNU Screen
* Ctrl-B doesn't collide with key bindings in Emacs

If this is true or not, I don't know, but it is a nice
and plausible story.

Zero config
-----------
tmux can be used without a config file.

I assume that the default configuration makes a lot of sense
for the people behind tmux, the original developers and
maintainers. And without doubt, they are much more clever than
I am. So, why not give the default config a try?

I removed my .tmux.conf and started tmux.

First impression
----------------
Wow, that is ... green!

As in something that ClaudioM (@[email protected])
would like :)

And, wow, I do need to learn a lot...

Learning the key bindings
-------------------------
Most tmux configurations I have seen on the internet use
vi-like key bindings for moving between windows, panes, copy,
and so on. This is also in the config I have lived many years
with and those bindings are etched deeply into my muscle
memory.

Switching to the default key bindings will take some
time and, probably, some frustration.

Below follows some key bindings that help to jump-start the
transition.

Moving between panes
--------------------
To move between panes, use the arrow keys.

* To move to the pane in the right, use Ctrl-B <right>
* To move to the pane in the left, use Ctrl-B <left>

Some other keys:

* Move to the previously active pane with: Ctrl-B ;
* Select next pane with: Ctrl-B o

Moving between windows
----------------------
To move between windows, use the p and n key:

* To move to the next window, use Ctrl-B n
* To move to the previous window, use Ctrl-B p
* Move to the previously active window with: Ctrl-B l

And, of course, you can use the window numbers, like
moving to window 4 with Ctrl-b 4.

Copy and paste
--------------
Without the vi keybindings, copy and paste works a bit
different. After reading the man page, it turned out that it
works very close to the way you copy and paste within Emacs.

Ctrl-B [ to start copy mode, move to the beginning of the
region you want to copy, and hit Ctrl-space. Go to the other
end of the region, and hit Alt-W. Just like in Emacs:)

Paste with Ctrl-B ].

Multiple paste buffers
----------------------
What is great, and unknown to me, is that you have something
like the kill-ring in Emacs: multiple paste buffers.

Copy some regions, without pasting, and then hit
Ctrl-B #
This will list the copy buffers.

Next, hit Ctrl-B =
This will give you the option to paste one of the buffers.

Renaming windows
----------------
This is now not <prefix>-shift-A, but Ctrl-B ,

A lot to discover
-----------------
This is enough to get started, but is only a small part of
what tmux has to offer, there is a lot more to discover.

Not everything is different from the most seen configs, like
switching between sessions is still <prefix>-( and <prefix>-)
and zoom is still <prefix>-z.

More than just key bindings
---------------------------
tmux config files in general set more options than just the
key bindings.

This goes from letting the window numbering start at one and
not at zero, using the OSC-52 protocol to copy to the system
clipboard, the color of the status bar, the items shown on the
status bar, and so on.

Some of those are really useful, and some are shiny rocks and
sticks.

For now, I will experiment with using tmux with no config at
all, and see which of those things I can't really do without.
Think of this as a 'tmux-without-config-challenge'.

I am sure I will learn some new things during this journey.

The discovery that tmux supports multiple paste buffers has
already made the start of this experiment worthwhile :)


Last edited: $Date: 2023/10/21 11:57:33 $