feat: more lf updates

feat/kile-v2
Ricard Illa 2022-03-15 08:21:12 +01:00
parent 63c45fab32
commit 80bbb3d24b
No known key found for this signature in database
GPG Key ID: F69A672B72E54902
3 changed files with 24 additions and 1 deletions

View File

@ -11,6 +11,19 @@ in {
enable = true; enable = true;
previewer.source = pv; previewer.source = pv;
settings.icons = true; settings.icons = true;
commands = {
get-mime-type = ''%xdg-mime query filetype "$f"'';
open = ''
''${{
test -L $f && f=$(readlink -f $f)
case $(file --mime-type $f -b) in
text/*) vi $fx;;
application/json) vi $fx;;
*) for f in $fx; do xdg-open $f > /dev/null 2> /dev/null & done;;
esac
}}
'';
};
extraConfig = '' extraConfig = ''
set cleaner ${cleaner} set cleaner ${cleaner}
''; '';

View File

@ -52,7 +52,7 @@ in pkgs.writeShellScript "pv.sh" ''
*/pdf) pdf "$1" "$2" "$3" "$4" "$5" ;; */pdf) pdf "$1" "$2" "$3" "$4" "$5" ;;
text/html) ${lynx} -width="$4" -display_charset=utf-8 -dump "$1" ;; text/html) ${lynx} -width="$4" -display_charset=utf-8 -dump "$1" ;;
text/troff) ${man} ./ "$1" | ${col} -b ;; text/troff) ${man} ./ "$1" | ${col} -b ;;
text/* | */xml) ${bat} --terminal-width "$4" -f "$1" ;; text/* | */xml | application/json) ${bat} --terminal-width "$4" -f "$1" ;;
application/zip) ${atool} --list -- "$1" ;; application/zip) ${atool} --list -- "$1" ;;
*opendocument*) ${odt2txt} "$1" ;; *opendocument*) ${odt2txt} "$1" ;;
audio/* | application/octet-stream) ${mediainfo} "$1" || exit 1 ;; audio/* | application/octet-stream) ${mediainfo} "$1" || exit 1 ;;

View File

@ -94,6 +94,16 @@
source "''${VENV_DIR}/''${selected_env}/bin/activate" source "''${VENV_DIR}/''${selected_env}/bin/activate"
} }
lf () {
tmp=$(mktemp)
lf-wrapper -last-dir-path="$tmp" "$@"
if [ -f "$tmp" ]; then
dir=$(cat "$tmp")
rm -f "$tmp"
[ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
fi
}
export LANG=en_US.utf8 export LANG=en_US.utf8
export LC_ALL=en_US.UTF-8 export LC_ALL=en_US.UTF-8
''; '';