• Stars
    star
    312
  • Rank 133,345 (Top 3 %)
  • Language
    Shell
  • Created almost 2 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

t - the smart tmux session manager

thumbnail

t - the smart tmux session manager

tmux is a powerful tool, but dealing with sessions can be painful. This script makes it easy to create and switch tmux sessions:

Prerequisites

How to install

1. Install tpm plugin

Add the following line to your tmux.conf file:

set -g @plugin 'joshmedeski/t-smart-tmux-session-manager'

Note: tpm recommends you list your plugins and then run tpm at the very bottom of your tmux.conf.

Then, run <prefix>I to install the plugin.

2. Add to path

To use the t script from anywhere, select your shell environment and follow the instructions.

Note: you'll need to check the path of your tpm plugins. It may be ~/.tmux/plugins or ~/.config/tmux/plugins depending on where your tmux.conf is located.

bash

Add the following line to ~/.bashrc

# ~/.tmux/plugins
export PATH=$HOME/.tmux/plugins/t-smart-tmux-session-manager/bin:$PATH
# ~/.config/tmux/plugins
export PATH=$HOME/.config/tmux/plugins/t-smart-tmux-session-manager/bin:$PATH
zsh

Add the following line to ~/.zprofile

# ~/.tmux/plugins
export PATH=$HOME/.tmux/plugins/t-smart-tmux-session-manager/bin:$PATH
# ~/.config/tmux/plugins
export PATH=$HOME/.config/tmux/plugins/t-smart-tmux-session-manager/bin:$PATH
fish

Add the following line to ~/.config/fish/config.fish

# ~/.tmux/plugins
fish_add_path $HOME/.tmux/plugins/t-smart-tmux-session-manager/bin
# ~/.config/tmux/plugins
fish_add_path $HOME/.config/tmux/plugins/t-smart-tmux-session-manager/bin

3. Recommended tmux settings

I recommend you add these settings to your tmux.conf to have a better experience with this plugin.

bind-key x kill-pane # skip "kill-pane 1? (y/n)" prompt
set -g detach-on-destroy off  # don't exit from tmux when closing a session

4. Customize Prompt (optional)

If your terminal supports Nerd Font symbols, you can customize your prompt.

set -g @t-fzf-prompt '  '

Or you can replace the prompt with anything you'd like.

How to use

  Run interactive mode
      t
        ctrl-s list only tmux sessions
        ctrl-x list only zoxide results
        ctrl-d list directories

  Go to session (matches tmux session, zoxide result, or directory)
      t {name}

  Open popup (while in tmux)
      <prefix>+T
        ctrl-s list only tmux sessions
        ctrl-x list only zoxide results
        ctrl-d list directories

  Show help
      t -h
      t --help

By default, this plugin is bound to <prefix>+T which triggers a fzf-tmux popup that display zoxide results. Type the result you want and when you hit enter it will create a tmux session and connect to it or, if the sessions already exists, switch to it.

If you are not in tmux, you can simply run t to start the interactive script, or call t {name} to jump directly to a session of your choosing.

Key Bindings

  • ctrl-s list only tmux sessions
  • ctrl-x list only zoxide results
  • ctrl-d list directories (or find if fd isn't installed)

How to add a custom keybinding

In order to add your own custom key binding to trigger the t script, add the following to your tmux.conf:

set -g @t-bind "J"

You can unbind the default by entering an unmappable string (e.g. none)

Background

Interested in learning more about how this script came to be? Check out Smart tmux sessions with zoxide and fzf. ]

Bonus: macOS keyboard shortcut

My personal workflow uses macOS Keyboard Shortcuts for tmux. I have bound the t popup to cmd+j with the following code:

Alacritty

Add the following line to your alacritty.yml

key_bindings:
  - { key: J, mods: Command, chars: "\x02\x54" } # open t - tmux smart session manager
Kitty

Add the following line to your kitty.conf

map cmd+j send_text all \x02\x54

Note: These bindings are based off the default prefix, ctrl+b (which converts to \x02). If you changed your prefix, I recommend watching my video which goes into depth how to customize your own keybindings in Alacritty.

More Repositories

1

dotfiles

Josh's dotfiles for his developer environment
Shell
310
star
2

sesh

Smart session manager for the terminal
Go
260
star
3

tmux-nerd-font-window-name

Nerd Font icons for your tmux windows
Shell
114
star
4

foundation-font-awesome-buttons

Font Awesome support for Foundation buttons
SCSS
55
star
5

alfred-foundation

Foundation project creation through Alfred
29
star
6

fish-lf-icons

Fish plugin to add Nerd Font icon support to the lf terminal file manager
Shell
15
star
7

rootbeer

A WordPress starter theme built with Genesis and Foundation
CSS
12
star
8

org-roam-spacemacs-layer

An org-roam spacemacs configuration layer
Emacs Lisp
12
star
9

telescope-smart-goto.nvim

A smart goto Telescope extension
Lua
11
star
10

joshmedeski.com

Josh Medeski's personal website (built with Astro)
MDX
8
star
11

awesome-vim-emulation

Vim-like tools, resources and extensions.
4
star
12

angular-mode

Emacs support for the Angular Javascript Library
2
star
13

aw

Alacritty + Wallpaper theme library and utility tool
TypeScript
2
star
14

wheniwork-cli

A simple cli tool for displaying personal When I Work information
TypeScript
2
star
15

htx-immersive-08-2019

Code samples from the DC class
HTML
2
star
16

neovim-pde

My personal Neovim setup
Lua
2
star
17

dclms

DigitalCrafts Learning Management System
JavaScript
1
star
18

jam

Monorepo for Josh Medeski
TypeScript
1
star
19

allthethingstracker.com-legacy

All The Things Tracker App. For tracking and staying up-to-date with your life.
TypeScript
1
star
20

tmux-smart-sessions

Smart tmux session manager and switcher
1
star
21

comfyui-sdxl-turbo-web-app

Proof of concept web app for using ComfyUI and sdxl turbo via the API
TypeScript
1
star
22

anchor-pinteresting

A Pinterest Inspired AnchorCMS Theme
JavaScript
1
star
23

foundation-sites-extended

An extended library of helper classes for Foundation for Sites framework
CSS
1
star
24

vinyl-companion

A companion for keeping vinyl organized
TypeScript
1
star
25

tmux-os-icon

Display operating system icon in TMUX status bar
Shell
1
star
26

joshmedeski

1
star
27

dc-exercises

Exercises for the DigitalCrafts (dc) program
JavaScript
1
star
28

spacecitymoviereviews.com

Movie review website
CSS
1
star
29

allthethingstracker-com

All the Things Tracker
TypeScript
1
star
30

htx-immsersive-08-2019-express-hosting-drink

Example Express application with Postgres for the Houston DigitalCrafts immersive program
JavaScript
1
star
31

folk-stack

TypeScript
1
star