How Claude Helped Me Fix a tmux Keybinding Conflict

As a years-long user of tmux, I’ve developed muscle memory for certain keybindings. One of these is prefix + ctrl-s for switching to the previous window (last-window).

Recently, I installed tmux-resurrect, a plugin that saves and restores tmux sessions. By default, it binds prefix + ctrl-s to save the session state. I struggled with this for much too long; every time I tried to switch windows, I was inadvertently saving my tmux environment instead. I wasn’t looking forward to digging into the tmux-resurrect documentation, but then I realized that Claude could solve this problem quickly.

Prompting Claude

I prompted Claude by writing: “I would like to use ctrl-a ctrl-s to switch to the previous window in tmux”. Claude analyzed the situation and could tell that tmux-resurrect was the culprit and suggested the needed code changes:

# Disable tmux-resurrect default save binding (ctrl-s) to allow last-window binding
set -g @resurrect-save 'off'

This restored my ability to use prefix + ctrl-s for switching to the previous window, but now I wondered how I would be able to save my tmux session. It was back to asking Claude for help.

Adding an Alternative Save Binding

It suggested the following code changes after providing several options, such as using ctrl-w or capital S. I thought capital S was more elegant and intuitive.

# Use capital S to save tmux environment instead
bind-key S run-shell ~/.files/tmux/plugins/tmux-resurrect/scripts/save.sh

Conclusion

I’ll admit, with Claude being so useful, I can see why people are trying to reduce engineering headcount.