plugins/cmusq | 2 +- plugins/fzplug | 18 ++++++------------ diff --git a/plugins/cmusq b/plugins/cmusq index aa67cb66690f8814c99729c392be465991ae57a2..1b30059d0b5b9e4f954bbb1cb5f919d6c6425e6f 100755 --- a/plugins/cmusq +++ b/plugins/cmusq @@ -40,7 +40,7 @@ *) nohup "$TERMINAL" -e cmus & ;; esac # 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" } >/dev/null 2>&1 diff --git a/plugins/fzplug b/plugins/fzplug index 6fcff416b5fe1fd237dd0e43a649a52990bc25a3..11dcf7fc89ae85af38f30a2e86f255c7b6b2c206 100755 --- a/plugins/fzplug +++ b/plugins/fzplug @@ -31,19 +31,13 @@ nnnpluginsdir="$HOME/.config/nnn/plugins" # Preview with bat if installed if type bat >/dev/null; then - plugin=$(find "$nnnpluginsdir" "$CUSTOMDIR1" "$CUSTOMDIR2" \ - -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") + BAT="bat --terminal-width='$(tput cols)' --decorations=always --color=always --style='${BAT_STYLE:-header,numbers}'" 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 # abort if no plugin was selected (ESC or ^C pressed).