mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 03:41:27 +00:00
Wait until cmus is ready and fix fzplug preview command
This commit is contained in:
parent
4dcefcc4d4
commit
f7e84bed70
|
@ -40,7 +40,7 @@ start_cmus() {
|
||||||
nohup "$TERMINAL" -e cmus & ;;
|
nohup "$TERMINAL" -e cmus & ;;
|
||||||
esac
|
esac
|
||||||
# Give the new terminal some time to open
|
# Give the new terminal some time to open
|
||||||
until pidof cmus >/dev/null; do sleep 0.1; done
|
until cmus-remote -C; do sleep 0.1; done
|
||||||
[ -n "$nnnwindow" ] && xdotool windowactivate "$nnnwindow"
|
[ -n "$nnnwindow" ] && xdotool windowactivate "$nnnwindow"
|
||||||
} >/dev/null 2>&1
|
} >/dev/null 2>&1
|
||||||
|
|
||||||
|
|
|
@ -31,20 +31,14 @@ nnnpluginsdir="$HOME/.config/nnn/plugins"
|
||||||
|
|
||||||
# Preview with bat if installed
|
# Preview with bat if installed
|
||||||
if type bat >/dev/null; then
|
if type bat >/dev/null; then
|
||||||
plugin=$(find "$nnnpluginsdir" "$CUSTOMDIR1" "$CUSTOMDIR2" \
|
BAT="bat --terminal-width='$(tput cols)' --decorations=always --color=always --style='${BAT_STYLE:-header,numbers}'"
|
||||||
-maxdepth 3 -perm -111 -type f 2>/dev/null | fzf --ansi --preview \
|
|
||||||
"cat {}" \
|
|
||||||
--preview-window right:66%:wrap --delimiter / --with-nth -1 \
|
|
||||||
--bind="?:toggle-preview")
|
|
||||||
else
|
|
||||||
plugin=$(find "$nnnpluginsdir" "$CUSTOMDIR1" "$CUSTOMDIR2" \
|
|
||||||
-maxdepth 3 -perm -111 -type f 2>/dev/null | fzf --ansi --preview \
|
|
||||||
"bat --terminal-width='$(tput cols)' --decorations=always --color=always \
|
|
||||||
--style='${BAT_STYLE:-header,numbers}' {}" \
|
|
||||||
--preview-window right:66% --delimiter / --with-nth -1 \
|
|
||||||
--bind="?:toggle-preview")
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
plugin=$(find "$nnnpluginsdir" "$CUSTOMDIR1" "$CUSTOMDIR2" \
|
||||||
|
-maxdepth 3 -perm -111 -type f 2>/dev/null | fzf --ansi --preview \
|
||||||
|
"${BAT:-cat} {}" --preview-window="right:66%:wrap" --delimiter / \
|
||||||
|
--with-nth -1 --bind="?:toggle-preview")
|
||||||
|
|
||||||
# Try running the script on the hovered file, and abort
|
# Try running the script on the hovered file, and abort
|
||||||
# abort if no plugin was selected (ESC or ^C pressed).
|
# abort if no plugin was selected (ESC or ^C pressed).
|
||||||
err=0
|
err=0
|
||||||
|
|
Loading…
Reference in a new issue