Git Product home page Git Product logo

tmux-sessionizer's Introduction

tmux-sessionizer (tms)

The fastest way to manage projects as tmux sessions

What is tmux-sessionizer?

Tmux Sessionizer is a tmux session manager that is based on ThePrimeagen's tmux-sessionizer but is opinionated and personalized to my specific tmux workflow. And it's awesome. Git worktrees are automatically opened as new windows, specific directories can be excluded, a default session can be set, killing a session jumps you to a default, and it is a goal to handle more edge case scenarios.

Tmux has keybindings built-in to allow you to switch between sessions. By default these are leader-( and leader-)

Switching between windows is done by default with leader-p and leader-n

tms-gif

Usage

The tms command

Running tms will find the repos and fuzzy find on them. It is very conveneint to bind the tms command to a tmux keybinding so that you don't have to leave your text editor to open a new project. I have this tmux binding bind C-o display-popup -E "tms". See the image below for what this look like with the tms switch keybinding

The tms switch command

There is also the tms switch command that will show other active sessions with a fuzzy finder and a preview window. This can be very useful when used with the tmux display-popup which can open a popup window above the current session. That popup window with a command can have a keybinding. The config could look like this bind C-j display-popup -E "tms switch". Then when using leader+C-j the popup is displayed (and it's fast)

tms-switch

Use tms --help

Scan for all git folders in specified directories, select one and open it as a new tmux session

Usage: tms [COMMAND]

Commands:
  config    Configure the defaults for search paths and excluded directories
  start     Initialize tmux with the default sessions
  switch    Display other sessions with a fuzzy finder and a preview window
  kill      Kill the current tmux session and jump to another
  sessions  Show running tmux sessions with asterisk on the current session
  help      Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

Configuring defaults

Configure the defaults for search paths and excluded directories

Usage: tms config [OPTIONS]

Options:
  -p, --paths <search paths>...      The paths to search through. Shell like expansions such as `~` are supported
  -s, --session <default session>    The default session to switch to (if avaliable) when killing another session
      --excluded <excluded dirs>...  As many directory names as desired to not be searched over
      --remove <remove dir>...       As many directory names to be removed from the exclusion list
      --full-path <true> <false>     Use the full path when displaying directories [possible values: true, false]
  -h, --help                         Print help

Installation

Cargo

Install with cargo install tmux-sessionizer or

From source

Clone the repository and install using cargo install --path . --force

Usage Notes

The 'tms sessions' command can be used to get a styled output of the active sessions with an asterisk on the current session. The configuration would look something like this

set -g status-right " #(tms sessions)"

E.g. tmux status bar If this configuration is used it can be helpful to rebind the default tmux keys for switching sessions so that the status bar is refreshed on every session switch. This can be configured with settings like this.

bind -r '(' switch-client -p\; refresh-client -S
bind -r ')' switch-client -n\; refresh-client -S

tmux-sessionizer's People

Contributors

jrmoulton avatar gawise avatar alexerrant avatar pwillumsen avatar tjex avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.