From dbbde07455dcb13224976ae8354373707423f7be Mon Sep 17 00:00:00 2001 From: deadguy Date: Sun, 21 Jan 2024 21:10:28 -0300 Subject: [PATCH] tres cambios por limpieza de codigo --- lfview | 17 +---------------- rfv | 2 +- vix | 12 +++++------- 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/lfview b/lfview index 6be6d2e..286226f 100755 --- a/lfview +++ b/lfview @@ -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}" ;; diff --git a/rfv b/rfv index 3833132..561bee7 100755 --- a/rfv +++ b/rfv @@ -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]}" diff --git a/vix b/vix index 1307c1e..bdba44d 100755 --- a/vix +++ b/vix @@ -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