News for hackers. Stuff that matters.
Re:Tmux Tutorial by Legogris on Tuesday September 24, 2019 @03:17AM (#21057379)
For those who customize their configs and, like me, SSH into all kinds of different short- and long-lived servers regularly: How do you stay sane?

I don't want to have to scp over my tmux conf to every single server I jump on, but OTOH difference in pretty much anything but the prefix gets really frustrating with habits. Particularly remembering all the emacs mode-keys when I really want the vi ones.

Re:Tmux Tutorial by mmahemoff on Tuesday September 24, 2019 @06:38AM (#21058449)
I have a Github dotfiles repo so I can set it up on any server in a couple of minutes, just by cloning the repo and running a script within it. If you're jumping between different servers, I would highly recommend having a quick way to setup config like this. It's a short investment that pays dividends for many years - not just for tmux config, but setup for bash, vim, and any other utils you rely on.

I use one tmux prefix for the local machine and another one for ssh sessions (setup in bash_profile using something like `if [[ -n "$SSH_CLIENT" ]] ; then tmux set-prefix ... etc`. You need different prefixes when using tmux recursively like this, so you can navigate both the inner and outer session.

I also use a different color theme for ssh sessions, whch helps to know which prefix to use until it becomes somewhat subconscious.

Re:Tmux Tutorial by Legogris on Tuesday September 24, 2019 @12:20PM (#21061789)
Used to have that actually, it's just too much of a hassle in today's cloud environment (I can easily SSH into dozens of fresh instances over a day and there's no way I'm baking my personal config into an image). I was considering to revisit and streamline that, but I imagine the cognitive overhead of different remote hosts having different configs is worse than what I have now (local=my config, remote=vanilla).

I just bind a different prefix and moved the bar to the top locally (I use urxvt+tmux with Ctrl+arrow keys etc to navigate tmux tabs instead of a tabbed terminal client) to get around the nesting issue.

Re:Tmux Tutorial by abcdef123xyz123 on Tuesday September 24, 2019 @03:58AM (#21057599)
I customize/copy my configs on the boxes I use regularly and just learn enough of the defaults to get by on boxes I am using only occasionally (eg I know enough vi to get by but if I am using a box for a bit I install emacs and if I am using it a lot I copy my .emacs as well). It helps that I keep my configs small and in a single file for each program so I can copy them quickly if I need to.

For tmux, it will look at VISUAL/EDITOR so for vi keys you could just try to remember to run it as "VISUAL=vi tmux" or to run "tmux set -g mode-keys vi" if you forget.

Re:Tmux Tutorial by Legogris on Tuesday September 24, 2019 @04:26AM (#21057738)
Didn't consider that the mode can be set from environment variable, then it can just be automatically set from my ssh command, thanks for the tip!

Searching back in the buffer in emacs mode is the one thing I've been keep having to look up

Re:Tmux Tutorial by lunchables on Tuesday September 24, 2019 @09:05AM (#21059673)
I use git and GNU stow. ssh in, clone the repo, stow tmux. Takes ~10 seconds on a new host. Also includes all the other dot files I use (bash, vim, etc).
Re:Tmux Tutorial by Legogris on Tuesday September 24, 2019 @12:24PM (#21061823)
Can't believe I missed stow, this goes straight to the bucket list!
Re:Tmux Tutorial by bloopernova on Tuesday September 24, 2019 @09:45AM (#21060055)
if you use iterm2 on a Mac, and aren't colour-blind, then there's a somewhat cool thing you can do with zsh+ssh: based on the hostname, change the colour of the tab to represent something like dev/test/qa/uat/stage/prod/etc.

Here's roughly what I use: https://gist.github.com/anthonyclarka2/f2aae1e167c7899d7d263...

It could also be adapted to anything other than ssh. For instance kubectl, aws cli, virtualenvs, etc etc.

Let me know if this helps, and if you have any suggestions!