Skip to content

Instantly share code, notes, and snippets.

@nikolovlazar
Last active August 8, 2023 15:01
Show Gist options
  • Save nikolovlazar/21a78f492e117a5e0dca1685cb668f4d to your computer and use it in GitHub Desktop.
Save nikolovlazar/21a78f492e117a5e0dca1685cb668f4d to your computer and use it in GitHub Desktop.
// Name: tmux sesh
// Description: Atach to a tmux session
// Author: Lazar Nikolov
// Twitter: @NikolovLazar
import '@johnlindquist/kit';
const sessionsCmd = await $`tmux list-sessions`;
let sessions = sessionsCmd.stdout
.split('\n')
.map((line) => line.split(':')[0])
.filter((sesh) => !!sesh);
let choice = await arg('Attach to session:', sessions);
await $`kitty --hold sh -c "tmux a -t ${choice}"`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment