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 script

howarddo2208.github.io

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

Fzf Tmux Session Manager script

howarddo2208.github.io

Howard Do@programming.dev to commandline@programming.dev · 2 years ago
message-square
0
link
fedilink
  • cross-posted to:
  • tmux@programming.dev
  • commandline@programming.dev
Fzf Tmux Session Manager
howarddo2208.github.io
external-link
Today I wrote a script to quickly search, delete and add new tmux session with the power of fzf. The --bind flag of fzf took me quite some time to debug because of many escape backslashes I needed to add. Here’s the script #!/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.

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.

  • 1 user / day
  • 1 user / week
  • 11 users / month
  • 158 users / 6 months
  • 47 local subscribers
  • 2.03K subscribers
  • 97 Posts
  • 228 Comments
  • Modlog
  • mods:
  • Erlingur@programming.dev
  • chaoticAnimals@programming.dev
  • Spyros@programming.dev
  • Gamma@programming.dev
  • BE: 0.19.11
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org