summaryrefslogtreecommitdiffstatshomepage
path: root/tmux
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2022-11-27 23:29:10 -0600
committerToby Vincent <tobyv13@gmail.com>2022-11-27 23:29:10 -0600
commitf51fa639e8034316ea9ad5a1de254a6c2206eea6 (patch)
tree8e9b00e9777d85e01926fb0483801a49967f7031 /tmux
parentd56367bc73d77219766cdba0bdc0595431323195 (diff)
feat(tmux): update sessionizer to use projectr
See: https://git.sr.ht/~tobyvin/projectr
Diffstat (limited to 'tmux')
-rwxr-xr-xtmux/.local/bin/tmux-sessionizer14
1 files changed, 3 insertions, 11 deletions
diff --git a/tmux/.local/bin/tmux-sessionizer b/tmux/.local/bin/tmux-sessionizer
index 7e8bad3..e688544 100755
--- a/tmux/.local/bin/tmux-sessionizer
+++ b/tmux/.local/bin/tmux-sessionizer
@@ -2,25 +2,17 @@
# shellcheck disable=2016,2089
if [ "$#" -eq 0 ]; then
- PROJECT_DIR="$HOME/src"
- DOCKER_DIR="$HOME/dkr"
- SESSION_DIR="$XDG_DATA_HOME/nvim/sessions"
PREVIEW_CMD='sel={}; less ${sel:-{q}} 2>/dev/null'
- ATTACHED=$(tmux display -p '#{session_path}')
lines=$(tmux display -p "#{pane_height}")
columns=$(tmux display -p "#{pane_width}")
WIDTH=$([ "$columns" -gt "120" ] && printf %s "120" || printf %s "90%")
HEIGHT=$([ "$lines" -gt "40" ] && printf %s "40" || printf %s "90%")
# shellcheck disable=2046
- set -- $({
- printf %s\\n "$HOME/.dotfiles"
- fd . "$PROJECT_DIR" "$DOCKER_DIR" --type=d --max-depth=1
- fd . "$SESSION_DIR" --type=f --max-depth=1 | sed "s|^$SESSION_DIR/||" | sed 's#%%\|__#/#g'
- } | sed 's|/$||' | sed "\|^$HOME\$|d" | sed "\|^$ATTACHED\$|d" | sort -u |
- timestamp.sh --type=directory --git --sessions="$SESSION_DIR" --format="{}:{1}" | sort -r | cut -d':' -f2 |
- fzf-tmux -p "$WIDTH,$HEIGHT" -- --multi --print-query -d/ --with-nth -1 --preview-window='right,75%,<80(up,75%,border-bottom)' --preview="$PREVIEW_CMD" |
+ set -- $(projectr ~/src ~/.dotfiles --git | sed "\|^$(tmux display -p '#{session_path}')\$|d" |
+ fzf-tmux -p "$WIDTH,$HEIGHT" -- --tac --multi --print-query -d/ --with-nth -1 \
+ --preview-window='right,75%,<80(up,75%,border-bottom)' --preview="$PREVIEW_CMD" |
tr -s '\n' ' ') && [ $# -gt 1 ] && shift
fi