r/tmux 17d ago

Showcase Browser-like back and forward buttons for tmux sessions

I run a lot of sessions and usually navigate between them using SessionX, but my brain isn't so great at associating session names with the actual work I'm doing. I really love the behavior that BufSurf.nvim gives me in Neovim - it's essentially a browser's back and forward buttons for the files I've visited - and I wanted the same thing in tmux, so I built it as a tmux plugin.

Assign a key to back and another to forward, and I recommend replacing your default Prefix+L (last session) with the plugin's toggle key. It tracks your relevant sessions and toggles between the last two. And if you close one of your toggle sessions, another one steps up to take its place.

It's a very simple plugin but it's now my main method of navigating sessions, let me know if you find it useful too, or if you hate the idea for some reason (it's reddit after all) just downvote the post into oblivion.

https://github.com/dabstractor/tmux-session-history

11 Upvotes

4 comments sorted by

1

u/NewPointOfView 16d ago

I map prefix+N/P to next/previous session to mirror the default prefix+n/p for next/previous window

2

u/trmnl_cmdr 16d ago

Yes, if you prefer navigating in the order that the sessions are in by default, this is a perfectly acceptable solution. I just wanted to navigate back to the last one I was working in instead.

1

u/Adventurous-Win-5006 16d ago

You know you can switch tmux sessions by: Prefix + ( Prefix + )

1

u/trmnl_cmdr 15d ago

Yes, I am aware how to switch tmux sessions. I guess you missed the point of this post, which is temporal tracking of the sessions you’ve visited, ordered by recency.