programming.dev
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Howard Do to commandline · 2 years ago

Fzf Tmux Session Manager

howarddo2208.github.io

external-link
message-square
2
link
fedilink
  • cross-posted to:
  • tmux
5
external-link

Fzf Tmux Session Manager

howarddo2208.github.io

Howard Do to commandline · 2 years ago
message-square
2
link
fedilink
  • cross-posted to:
  • tmux
Today I wrote a script to quickly search, delete and add new tmux session with the power of fzf. The script The --bind flag of fzf took me quite some time to debug because of many escape backslashes I needed to add. #!/bin/bash # ~/.local/bin/tmux-session-manager FIND_DEFAULT_COMMAND="tmux list-sessions | sed -E 's/:.*$//' | grep -v \"^$(tmux display-message -p '#S')\$\"" tmux list-sessions | sed -E 's/:.*$//' | grep -v "^$(tmux display-message -p '#S')$"\ | fzf --reverse --bind "ctrl-x:execute(tmux kill-session -t {})+reload(${FIND_DEFAULT_COMMAND})"\ --bind "ctrl-n:execute(bash -c 'read -p \"Name: \" name; tmux new -d -s \"\$name\"')+reload(${FIND_DEFAULT_COMMAND})" \ --bind "ctrl-r:reload(${FIND_DEFAULT_COMMAND})"\ --header 'Enter: switch session | Ctrl-X: kill session | Ctrl-N: new session | Ctrl-R: refresh list'\ | xargs tmux switch-client -t And I bind it into s key to overwrite the default tmux behavior.
alert-triangle
You must log in or register to comment.
  • dlvhdr@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    2 years ago

    There’s also https://github.com/joshmedeski/t-smart-tmux-session-manager

    • Howard DoOP
      link
      fedilink
      arrow-up
      2
      ·
      2 years ago

      nice, didn’t know about it, thank u!

commandline

commandline

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: [email protected]
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 1 user / day
  • 1 user / week
  • 26 users / month
  • 162 users / 6 months
  • 685 local subscribers
  • 1.97K subscribers
  • 92 Posts
  • 217 Comments
  • Modlog
  • mods:
  • Erlingur
  • chaoticAnimals
  • Spyros
  • Gamma
  • BE: 0.19.11
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org