tucson.social
  • 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
link
fedilink
  • cross-posted to:
  • [email protected]
5
external-link

Fzf Tmux Session Manager

howarddo2208.github.io

Howard Do@programming.dev to commandline@programming.dev · 2 years ago
message-square
2
link
fedilink
  • cross-posted to:
  • [email protected]
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.
  • 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: [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
  • 1 user / month
  • 126 users / 6 months
  • 1 local subscriber
  • 2.03K subscribers
  • 97 Posts
  • 198 Comments
  • Modlog
  • mods:
  • Erlingur@programming.dev
  • Gamma@programming.dev
  • chaoticAnimals@programming.dev
  • Spyros@programming.dev
  • BE: 0.19.12
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org