by devonnull on 3/5/25, 1:31 AM with 97 comments
by anyfoo on 3/5/25, 2:30 AM
Note that I have been using text-only terminals since the 1980s, but I've adapted my tty usage over time.
The problem that tmux (or screen) brings are first and foremost:
* Smooth/fast scrolling goes away. I can no longer give my trackpad a slight push to find myself tens or hundreds of lines in the scrollback history, and visually scan by slightly pushing my fingers back and forth. Instead I have to use the horrendous in-tmux scrollback using "Ctrl-b [".
* My terminal app's tabs and windows are not tmux's tabs and windows. I cannot freely arrange them in space, snap them off with the mouse, easily push them to another desktop, and so on. I have to start a multiple tmux clients and do awkward keyboard interactions with them for any of the same.
* tmux's terminal emulation and my terminal emulator's terminal emulation (heh) are not congruent. As a result, programs cannot make full use of my actual terminal's capabilities. For example selecting, copying, and pasting text sometimes behave weirdly, and there are other annoyances.
What I'd really like to have instead is terminal session management at a higher level, i.e. involving my actual graphical terminal app itself. Attaching to a running session would mean restoring the terminal app's windows and tabs, and the entire scrollback history within (potentially with some lazy loading).
tmux could likely be a major part of that, by providing the option of replacing its tty-facing frontend with a binary protocol that the graphical terminal app talks to, while keeping the backend (i.e. the part that provides the tty to anything running inside it) the same as it is today.
As it is, the downsides of using tmux all the time are too high.
by mdaniel on 3/5/25, 4:05 AM
- env KUBECONFIG=$HOME/.kube/setup-1 tmux new -s setup1
- teamocil: https://github.com/remi/teamocil#readme (MIT)
The first one I use for circumstances where I want to investigate a lot of different things in a dedicated cluster, without the hassle of having $(kubectl --kubeconfig ...) or the risk of k() { kubectl --kubeconfig ... "$@"; } and losing track of what context I'm in[1]. Because, with iTerm2's integration command-n or command-t opens a new window or tab but with retaining the credential scoping. If I need to change scopes, I can just detach from the tmux session, attach to a different one, confident that I don't have any variables to unset
The second I use in "standard" setups where I want to view the same configuration every day (say: web, api, database pods). Having teamocil allows me to either have those same commands laid out in the same pattern as yesterday, or I've also had pretty good luck just generating the yaml files because their syntax is simple enough
1: related to that, if you haven't seen it, iTerm2 offers the ability to set the RGB of a tab via OSC: https://iterm2.com/documentation-escape-codes.html#:~:text=t...
by Tsiklon on 3/5/25, 2:35 AM
Likewise i enable vim keybindings, mouse mode, and if you use a Mac and iTerm selecting text will automatically drop it into your clipboard ready to paste.
I tend to make use of the following command - which will output the last 100000 lines of the current pane to a text file local to you; it’s useful for documenting screwups, maintenance work, and of course making notes on what you’ve done for future reference
> bind-key P command-prompt -p 'save history to filename:' -I '~/tmux.history' 'capture-pane -S -100000 ; save-buffer %1 ; delete-buffer'
by pjs_ on 3/5/25, 6:24 AM
by YouWhy on 3/5/25, 4:20 AM
When I learnt tmux, I had to access multiple VMs which were de-facto ephemeral, which meant customization was not an option anyway. I kind of learnt to like the defaults as they are.
by remram on 3/5/25, 3:37 AM
It's a tiny bit more scriptable, but it's not like a real API either.
by lproven on 3/5/25, 10:35 AM
I am aware of tmux, dvtm, zellij, and GNU screen. That's it: just 4.
Has anyone written a comparison of them? I would be genuinely interested. I personally favour ease of use over features.
by lemonwaterlime on 3/5/25, 3:30 AM
by zvr on 3/5/25, 8:06 AM
I use screen, but whatever I have read till now on comparison seems to point more to personal preferences.
by lynx97 on 3/5/25, 5:55 AM
1. Set the prefix key to C-Space. Much easier to type then any letter, and (in my case) only collides with Emacs set-mark. Its easy to remember and just type C-Space C-Space in that case.
2. Set IC (insert key) as prefix2. If you have a full-size keyboard, you can now scroll up by pressing insert (on the block of 6) and pageup. Easy to type.
3. Using sessions for ssh hosts. Add ControlPersist and/or AddKeysToAgent to ~/.config/ssh and bind the following to some key. Pressing that key will prompt for a hostname, and create a new session named after that hostname. The default-command will make it such that Prefix c will open a new window which is already logged in on that host. Its not the same as running a remote tmux, as your windows/session will not persist on the remote host, but it avoids nested tmux. I use it all the time during a typical day...
command-prompt -p "Secure Shell ([user@]host):" { new-session -A -s "%1" "ssh %1" ; set-option default-command "ssh %1" }
by eu on 3/5/25, 2:14 AM
# ~/.tmux.conf
set-option -g prefix C-a
by g-b-r on 3/5/25, 4:37 AM
by azaras on 3/5/25, 9:22 AM
I changed the Keybindings for splitting and moving around terminals to be as in Emacs, and I am very happy.
by alyandon on 3/5/25, 4:19 PM
https://gist.github.com/alyandon/b19e2634fac6505bb5bd0e0c99d...
Yes - I'm a terrible person.
by avinassh on 3/5/25, 6:38 AM