m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-18 08:13:40 -05:00

Added a new tmux snippet that allows for creation of new sessions as well as working within tmux.

Owen Garland
2017-07-27 13:39:39 +02:00
parent 6fac7bc191
commit 65b281c5b9

@@ -450,6 +450,20 @@ ftags() {
### tmux ### tmux
```sh
# tm - create new tmux session, or switch to existing one. Works from within tmux too. (@bag-man)
# `tm` will allow you to select your tmux session via fzf.
# `tm irc` will attach to the irc session (if it exists), else it will create it.
tm() {
[[ -n "$TMUX" ]] && change="switch-client" || change="attach-session"
if [ $1 ]; then
tmux $change -t "$1" 2>/dev/null || (tmux new-session -d -s $1 && tmux $change -t "$1"); return
fi
session=$(tmux list-sessions -F "#{session_name}" 2>/dev/null | fzf --exit-0) && tmux $change -t "$session" || echo "No sessions found."
}
```
```sh ```sh
# fs [FUZZY PATTERN] - Select selected tmux session # fs [FUZZY PATTERN] - Select selected tmux session
# - Bypass fuzzy finder if there's only one match (--select-1) # - Bypass fuzzy finder if there's only one match (--select-1)