D•Scribe
  • 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
0
fedilink
1
external-link

Fzf Tmux Session Manager

howarddo2208.github.io

Howard Do@programming.dev to commandline@programming.dev · 2 years ago
message-square
0
fedilink
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.

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.

  • 16 users / day
  • 16 users / week
  • 16 users / month
  • 16 users / 6 months
  • 0 local subscribers
  • 1.81K subscribers
  • 78 Posts
  • 0 Comments
  • Modlog
  • mods:
  • Erlingur@programming.dev
  • chaoticAnimals@programming.dev
  • Spyros@programming.dev
  • Gamma@programming.dev
  • UI: unknown version
  • BE: 0.19.9
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org