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

Fzf Tmux Session Manager

howarddo2208.github.io

external-link
message-square
2
fedilink
  • cross-posted to:
  • tmux@programming.dev
  • commandline@programming.dev
5
external-link

Fzf Tmux Session Manager

howarddo2208.github.io

Howard Do@programming.dev to commandline@programming.dev · 2 years ago
message-square
2
fedilink
  • cross-posted to:
  • tmux@programming.dev
  • commandline@programming.dev
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.
  • dlvhdr@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    2 years ago

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

    • Howard Do@programming.devOP
      link
      fedilink
      arrow-up
      2
      ·
      2 years ago

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

commandline@programming.dev

commandline@programming.dev

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: !commandline@programming.dev
Visibility: Public
globe

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

  • 7 users / day
  • 31 users / week
  • 54 users / month
  • 175 users / 6 months
  • 46 local subscribers
  • 1.98K subscribers
  • 95 Posts
  • 218 Comments
  • Modlog
  • mods:
  • Erlingur@programming.dev
  • chaoticAnimals@programming.dev
  • Spyros@programming.dev
  • Gamma@programming.dev
  • BE: 0.19.8
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org