mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-18 00:03:39 -05:00
Added a new tmux snippet that allows for creation of new sessions as well as working within tmux.
14
Examples.md
14
Examples.md
@@ -450,6 +450,20 @@ ftags() {
|
||||
|
||||
### 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
|
||||
# fs [FUZZY PATTERN] - Select selected tmux session
|
||||
# - Bypass fuzzy finder if there's only one match (--select-1)
|
||||
|
||||
Reference in New Issue
Block a user