Skip to content

Instantly share code, notes, and snippets.

@byStrange
Last active May 17, 2026 19:44
Show Gist options
  • Select an option

  • Save byStrange/023808ef914b198bf504adc1d0cb88b5 to your computer and use it in GitHub Desktop.

Select an option

Save byStrange/023808ef914b198bf504adc1d0cb88b5 to your computer and use it in GitHub Desktop.
function gtm
set -l target (locate -r '/\.git$' | rev | cut -d/ -f2- | rev | fzf)
if test -n "$target"
set -l name (string replace -r '\.' '_' (basename "$target"))
if not tmux has-session -t "$name" 2>/dev/null
tmux new-session -d -c "$target" -s "$name"
end
if test -n "$TMUX"
tmux switch-client -t "$name"
else
tmux attach-session -t "$name"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment