<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>hi, it&#39;s mike</title>
    <link>https://mike.puddingtime.org/tags/configs/</link>
    <description>Recent content on hi, it&#39;s mike</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <managingEditor>mike@puddingtime.org (mike)</managingEditor>
    <webMaster>mike@puddingtime.org (mike)</webMaster>
    <copyright>© 2026, mike</copyright>
    <lastBuildDate>Sat, 09 May 2026 18:13:35 +0000</lastBuildDate>
    <atom:link href="https://mike.puddingtime.org/tags/configs/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Figuring out tmux</title>
      <link>https://mike.puddingtime.org/posts/2026-05-09-figuring-out-tmux/</link>
      <pubDate>Sat, 09 May 2026 18:13:35 +0000</pubDate><author>mike@puddingtime.org (mike)</author>
      <guid>https://mike.puddingtime.org/posts/2026-05-09-figuring-out-tmux/</guid>
      <description>After zellij got a little rough with iPad/Blinkterm, I decided to go back to tmux. It felt pretty itchy at first, but I think I’ve settled on a good pattern.</description>
      <content:encoded><![CDATA[<p><a href="https://zellij.dev">Zellij</a> has some genuinely nice features. It&rsquo;s much more discoverable and less foreboding than vanilla tmux. It just did this thing with Blink that ended up slowly chewing into the number of available lines on the screen I could never sort out, so back to tmux.</p>
<p>I&rsquo;ve never been comfortable with tmux&rsquo;s default leader, so my first change was to make <code>C-space</code> the leader:</p>
<p><code>set -g prefix C-space</code></p>
<p>&hellip; and to help me remember the few things I care about, I modified the status bar to add some help:</p>
<p><code>set -g status-right &quot;c:new  ←/→:nav  ,:rename  d:detach %H:%M&quot;</code></p>
<p>&hellip; but I don&rsquo;t like the leader key generally, so I made some keybindings with meta. Most of them stick to the base tmux key, iirc, but just let me chord them with meta vs. using the leader key:</p>






<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl"># Some basics
</span></span><span class="line"><span class="cl">unbind C-b
</span></span><span class="line"><span class="cl">bind -n M-c new-window -c &#34;#{pane_current_path}&#34;
</span></span><span class="line"><span class="cl">bind -n M-r source-file ~/.tmux.conf
</span></span><span class="line"><span class="cl">bind -n M-d detach
</span></span><span class="line"><span class="cl">bind -n M-, command-prompt -I &#34;#W&#34; &#34;rename-window &#39;%%&#39;&#34;
</span></span><span class="line"><span class="cl">bind -n M-x command-prompt
</span></span><span class="line"><span class="cl">bind -n M-z resize-pane -Z
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"># Option+Shift+arrows
</span></span><span class="line"><span class="cl">bind -n S-M-Left previous-window
</span></span><span class="line"><span class="cl">bind -n S-M-Right next-window
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"># split panes using | and - (I borrowed this idea from someone -- the defaults are incomprehensible to me)
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">bind -n M-| split-window -h
</span></span><span class="line"><span class="cl">bind -n M-- split-window -v
</span></span><span class="line"><span class="cl">unbind &#39;&#34;&#39;
</span></span><span class="line"><span class="cl">unbind %</span></span></code></pre></div>
<p>All those pretty much let me use tmux in the &ldquo;one session for everything&rdquo; pattern. Log in, fire it up, rejoin where you left off.</p>
<p>To help support my most common use case, which is logging into my Mac mini from my laptop or iPad, I added some conditional logic to my <code>.zshrc</code> template in <a href="https://www.chezmoi.io">chezmoi</a></p>






<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">{{- if eq .chezmoi.hostname &#34;mikes-mac-mini&#34; }}
</span></span><span class="line"><span class="cl"># Auto-reconnect to tmux on SSH/mosh sessions
</span></span><span class="line"><span class="cl">if [[ -z &#34;$TMUX&#34; ]] &amp;&amp; { [[ -n &#34;$SSH_CONNECTION&#34; ]] || [[ -n &#34;$SSH_TTY&#34; ]] || [[ &#34;$(ps -o comm= -p $PPID 2&gt;/dev/null)&#34; == &#34;mosh-server&#34; ]]; }; then
</span></span><span class="line"><span class="cl">  tmux new-session -A -s coding
</span></span><span class="line"><span class="cl">fi
</span></span><span class="line"><span class="cl">{{- end }}</span></span></code></pre></div>
<p>&hellip;so if I&rsquo;m signing in from an SSH session, I get dropped back into my standard tmux coding session.</p>
<h2 id="graduating-to-multi-session-tmux">Graduating to multi-session tmux</h2>
<p>Beyond the ergonomics of tmux commands and the convenience of being able to get back into my old session, I was struggling a little with doing a bunch of things inside the same session. Windows weren&rsquo;t very helpfully labeled, so I was constantly renaming them, tabbing around between them was getting tedious, so I decided to adopt a multi-session approach, opening a new tmux in each of my working directories.</p>
<p>That was made super easy by <a href="https://github.com/joshmedeski/sesh">sesh</a>. You just run <code>sesh picker</code> to get an interactive list of your tmux sessions and (if you have <a href="https://github.com/ajeetdsouza/zoxide">zoxide</a> installed) your most frequently visited directories. So, pick a session to rejoin it, or pick a directory to open up a tmux session inside it.</p>
<p>To make hopping around between sessions simpler, I added a <code>M-s</code> keystroke:</p>
<p><code>bind -n M-s choose-tree -Zs</code></p>
<p>That gives me a list of my open tmux sessions I can cursor around in and/or pick a window from, with a quick preview of the windows in a given session when I cursor over it.</p>
<p>To support a multi-session approach for ssh logins, I modified my <code>.zshrc</code>:</p>






<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl"># Auto-reconnect to tmux on SSH/mosh sessions
</span></span><span class="line"><span class="cl">if [[ -n &#34;$SSH_CONNECTION&#34; ]] &amp;&amp; [[ -z &#34;$TMUX&#34; ]] &amp;&amp; [[ $- == *i* ]]; then
</span></span><span class="line"><span class="cl">  session=$(sesh list -i | fzf --ansi --height 40% --reverse --prompt &#39;sesh &gt; &#39;)
</span></span><span class="line"><span class="cl">  [[ -n &#34;$session&#34; ]] &amp;&amp; exec sesh connect &#34;$session&#34;
</span></span><span class="line"><span class="cl">fi</span></span></code></pre></div>
<p>So when I ssh into the mini now, I get that interactive <code>sesh</code> list and I can rejoin the right project session, or go to some directory and get a new tmux session inside it (or bail with <code>esc</code> and go somewhere else).</p>
<p>Side note: <a href="https://github.com/ajeetdsouza/zoxide">zoxide</a> is so nice. Instead of <code>cd</code> + <code>some long path</code> you just <code>z some-fragment-of-a-dir-you've-visited</code> and go there. It remembers where you&rsquo;ve been.</p>
<p>The final piece was landing on a color treatment for all of it:</p>






<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-fallback" data-lang="fallback"><span class="line"><span class="cl">set -g window-style &#39;bg=colour236&#39;
</span></span><span class="line"><span class="cl">set -g window-active-style &#39;bg=colour234&#39;
</span></span><span class="line"><span class="cl">set -g window-status-current-style &#34;fg=colour231,bg=colour39,bold&#34;
</span></span><span class="line"><span class="cl">set -g status-style &#34;fg=colour231,bg=colour25&#34;
</span></span><span class="line"><span class="cl">set -g status-left &#34;#[fg=white,bg=colour22,bold] #S #[default] &#34;</span></span></code></pre></div>
<p>That gives me a WordPerfect 5.1 blue status bar with the active window getting a lighter blue background and white/bold text, and the current session name getting a green background with white/bold text. Much easier to know where I am both by session and window.</p>
<p>Putting it all together, tmux feels much more fluid.</p>
<p><a href="https://photos.smugmug.com/photos/i-LXBnhNs/0/LJMr9CK6dMjWK3PTh53ZCRXsXtSBncN3pZcHVBMMh/XL/i-LXBnhNs-XL.jpg" class="glightbox" data-gallery="post-d3827b299604f1b8890dd14b032a236c"><img src="https://photos.smugmug.com/photos/i-LXBnhNs/0/LJMr9CK6dMjWK3PTh53ZCRXsXtSBncN3pZcHVBMMh/XL/i-LXBnhNs-XL.jpg" alt="tmux session selector " loading="lazy"></a>
</p>
]]></content:encoded>
    </item>
  </channel>
</rss>
