summaryrefslogtreecommitdiffstatshomepage
path: root/tmux/.local
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2022-10-07 14:59:49 -0500
committerToby Vincent <tobyv13@gmail.com>2022-10-07 14:59:49 -0500
commit0055f3a2d829c6dd135e709fc1b53c75554da7d7 (patch)
tree7042ea9aa8c1d69a234c205735aa85378c0b07c3 /tmux/.local
parent60eef9f842fb85e7fe413b17d37788a32215198e (diff)
fix(tmux): improve tmux fzf preview
Diffstat (limited to 'tmux/.local')
-rwxr-xr-xtmux/.local/bin/tmux-sessionizer13
1 files changed, 6 insertions, 7 deletions
diff --git a/tmux/.local/bin/tmux-sessionizer b/tmux/.local/bin/tmux-sessionizer
index 11e4fdd..e7f3e25 100755
--- a/tmux/.local/bin/tmux-sessionizer
+++ b/tmux/.local/bin/tmux-sessionizer
@@ -41,14 +41,13 @@ else
' | sort -r | sort -t':' -r -k2 | uniq -s10 | sort -r | cut -d':' -f2 | sed "s#^$attached\$##g" | sed '/^$/d')"
output="$(printf %s\\n "$DIRS" | fzf-tmux -p -- --print-query -d/ --with-nth -1 \
- --preview-window=right,75% --preview="onefetch {} 2>/dev/null ||
- ([ -e {}/README.md ] && glow --style=dark {}/README.md 2>/dev/null) ||
+ --preview-window=right,75% --preview='width=$(( (($(tput cols) * 3) + (4 - 1) ) / 4 ))
+ onefetch --hidden $([ "$width" -gt 80 ] || echo "--show-logo=never") {} 2>/dev/null ||
+ ([ -e {}/README.md ] && glow --local --style=dark {}/README.md 2>/dev/null) ||
exa --tree --git-ignore --level=3 --icons {} 2>/dev/null ||
- (printf '%s' {q} | sed 's|/\$||' | xargs hut git show --repo 2>/dev/null && glow {q}/blob/HEAD/README.md --style=dark 2>/dev/null) ||
- gh repo view {q} 2>/dev/null ||
- printf 'Create new project:\n %s' {q} |
- sed 's|^ \([^/~][^/]*\)\$| $HOME/\1|' |
- sed 's/^ //'" |
+ # if input is git remote
+ (printf "%s" {q} | sed "s|/\$||" | xargs hut git show --repo 2>/dev/null) ||
+ gh repo view {q} 2>/dev/null' |
tr -s '\n' ' ')"
query="$(printf %s\\n "$output" | cut -d' ' -f1)"