bin: slight behavior fixes

This commit is contained in:
xeruf 2021-11-11 20:45:58 +01:00
parent 22f9c077c8
commit 61b37ec463
3 changed files with 3 additions and 7 deletions

View File

@ -16,7 +16,7 @@ test -x "$(dirname "$last")" &&
tput setaf 4 && $elevate file -E "$last" | { grep -v --color=never 'directory$' || true; } tput setaf 4 && $elevate file -E "$last" | { grep -v --color=never 'directory$' || true; }
case "$($elevate file --dereference --mime "$last")" in case "$($elevate file --dereference --mime "$last")" in
(*inode/directory*) tput sgr0 && $(test -x "$last" || echo "sudo") ls -l --color=always --human-readable --group-directories-first --file-type --dereference-command-line --all "$@" | less -XF;; (*inode/directory*) tput sgr0 && $(test -x "$last" || echo "sudo") ls -l --color=always --human-readable --group-directories-first --file-type --dereference-command-line --all "$@" | less -RF;;
(*binary) (*binary)
case "$(file "$last")" in case "$(file "$last")" in
(*:\ *compress*) /usr/share/nvim/runtime/macros/less.sh "$@";; (*:\ *compress*) /usr/share/nvim/runtime/macros/less.sh "$@";;
@ -24,7 +24,7 @@ case "$($elevate file --dereference --mime "$last")" in
esac esac
tput setaf 3 && $elevate stat --format '%A size %sB, birth: %.10w mod %.10y' "$last" tput setaf 3 && $elevate stat --format '%A size %sB, birth: %.10w mod %.10y' "$last"
;; ;;
(*) $elevate bat --style header "$@" --pager 'less -RXF' (*) $elevate bat --style header "$@" --pager 'less -RF'
tput setaf 3 && $elevate stat --format '%A size %sB, birth: %.10w mod %.10y' "$last" tput setaf 3 && $elevate stat --format '%A size %sB, birth: %.10w mod %.10y' "$last"
# TODO don't duplicate stat # TODO don't duplicate stat
;; ;;

View File

@ -6,6 +6,6 @@ runti() {
highlight "$*" && "$@" highlight "$*" && "$@"
} }
cols="$(expr $(tput cols) / $1 / 4 \| 1)" cols="$(expr $(tput cols) / $1 / 4 \| 1)"
runti timg --grid=${cols} -g $(tput cols)x$(expr $1 \* $cols) "${@:2}" runti timg --title --grid=${cols} -g $(tput cols)x$(expr $1 \* $cols) "${@:2}"
runti viu --name -h $1 "${@:2}" runti viu --name -h $1 "${@:2}"
runti tiv -h $1 -c $cols "${@:2}" runti tiv -h $1 -c $cols "${@:2}"

View File

@ -1,8 +1,4 @@
#!/bin/sh #!/bin/sh
# Listing for quick directory switcher based on zoxide and fzf # Listing for quick directory switcher based on zoxide and fzf
if test -d "$1" -o "$1" = "-"
then echo "$@"
else
set -o noglob set -o noglob
zoxide query -sl "$@" zoxide query -sl "$@"
fi