tres cambios por limpieza de codigo

This commit is contained in:
deadguy 2024-01-21 21:10:28 -03:00
parent 9385eb5cc3
commit dbbde07455
Signed by: dgy
GPG Key ID: 37CA55B52CF63730
3 changed files with 7 additions and 24 deletions

17
lfview
View File

@ -21,11 +21,6 @@ FILE_PATH="${1}" # Full path of the highlighted file
FILE_EXTENSION="${FILE_PATH##*.}"
FILE_EXTENSION_LOWER=$(echo "${FILE_EXTENSION}" | tr '[:upper:]' '[:lower:]')
# Settings
HIGHLIGHT_SIZE_MAX=262143 # 256KiB
HIGHLIGHT_TABWIDTH=8
HIGHLIGHT_STYLE='pablo'
handle_extension() {
case "${FILE_EXTENSION_LOWER}" in
# Archive
@ -81,17 +76,7 @@ handle_mime() {
text/html) lynx -dump "${FILE_PATH}" ;;
text/troff) man ./ "${FILE_PATH}" | col -b ;;
text/* | */xml)
if [ "$(stat --printf='%s' -- "${FILE_PATH}")" -gt "${HIGHLIGHT_SIZE_MAX}" ]; then
exit 2
fi
# if [ "$(tput colors)" -ge 256 ]; then
# local highlight_format='xterm256'
# else
# local highlight_format='ansi'
# fi
bat --color always --style plain --paging never --wrap character -- "${FILE_PATH}"
# highlight --replace-tabs="${HIGHLIGHT_TABWIDTH}" --out-format="${highlight_format}" \
# --style="${HIGHLIGHT_STYLE}" --force -- "${FILE_PATH}"
bat --color always --style plain --paging never -- "${FILE_PATH}"
exit 2
;;
application/zip) unzip -l -- "${FILE_PATH}" ;;

2
rfv
View File

@ -14,4 +14,4 @@ IFS=: read -ra selected < <(
--preview 'bat --color=always {1} --highlight-line {2}' \
--preview-window 'up,60%,border-bottom,+{2}+3/3,~3'
)
[ -n "${selected[0]}" ] && vim "${selected[0]}" "+${selected[1]}"
[ -n "${selected[0]}" ] && $EDITOR "${selected[0]}" "+${selected[1]}"

12
vix
View File

@ -1,9 +1,7 @@
#!/bin/sh
# if [ "$(file --mime-type "$(readlink -f "$*")" -b)" = "text/plain" ]; then
# tmux split-window -hl 95 "nvim --cmd \":lua vim.g.noplugins=1\" \"$*\""
# else
# tmux split-window -hl 95 "$EDITOR \"$*\""
# fi
tmux split-window -hl 95 "$EDITOR \"$*\""
if [ "$(fd -tf --exact-depth=1 -e lua -e py -e rs)" ]; then
tmux split-window -hl 95 "$EDITOR \"$*\""
else
tmux split-window -hl 95 "nvim --cmd \":lua vim.g.noplugins=1\" \"$*\""
fi