plugins/preview-tui | 22 +++++++++++----------- diff --git a/plugins/preview-tui b/plugins/preview-tui index 7b4a7a0aa818eec47b5769bd776a1d11352ebb45..45beac51a4f2238bc395108e24dc6ae667a37fda 100755 --- a/plugins/preview-tui +++ b/plugins/preview-tui @@ -114,17 +114,6 @@ preview_file () { kill %- %+ 2>/dev/null && wait %- %+ 2>/dev/null clear - # Detecting the exact type of the file: the encoding, mime type, and - # extension in lowercase. - encoding="$(file -Lb --mime-encoding -- "$1")" - mimetype="$(file -Lb --mime-type -- "$1")" - ext="${1##*.}" - if [ -n "$ext" ]; then - ext="$(printf "%s" "${ext}" | tr '[:upper:]' '[:lower:]')" - fi - lines=$(($(tput lines)-1)) - cols=$(tput cols) - # Trying to use pistol if it's available. if [ "$USE_PISTOL" -ne 0 ] && exists pistol; then fifo_pager pistol "$1" @@ -137,6 +126,17 @@ fifo_pager scope.sh "$1" "$cols" "$lines" "$(mktemp -d)" \ "True" 2>/dev/null return fi + + # Detecting the exact type of the file: the encoding, mime type, and + # extension in lowercase. + encoding="$(file -Lb --mime-encoding -- "$1")" + mimetype="$(file -Lb --mime-type -- "$1")" + ext="${1##*.}" + if [ -n "$ext" ]; then + ext="$(printf "%s" "${ext}" | tr '[:upper:]' '[:lower:]')" + fi + lines=$(($(tput lines)-1)) + cols=$(tput cols) # Otherwise, falling back to the defaults. if [ -d "$1" ]; then