Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Activate left window when the current one is closed in tmux

CLI Tools #tmux #configuration #hooks #productivity

When I close a window in tmux, it typically activates the window to its right. I prefer the previously active window to be activated instead. I couldn’t find a direct setting for this, but tmux provides hooks for various events. By setting the window-unlinked hook to trigger last-window, I can achieve the desired behavior.

Add the following to your .tmux.conf:

set-hook -g window-unlinked 'last-window'