1
0
Fork 0

minor script changes

This commit is contained in:
Luca Bilke 2024-02-01 08:24:30 +01:00
parent 625d81d765
commit ed6954e239
3 changed files with 16 additions and 6 deletions

10
.local/bin/escapefilter Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env perl
# this script should filter out any terminal escapes in a text stream
while (<>) {
s/ \e[ #%()*+\-.\/]. |
\e\[ [ -?]* [@-~] | # CSI ... Cmd
\e\] .*? (?:\e\\|[\a\x9c]) | # OSC ... (ST|BEL)
\e[P^_] .*? (?:\e\\|\x9c) | # (DCS|PM|APC) ... ST
\e. //xg;
print;
}

View file

@ -2,9 +2,10 @@
set -e
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
command lf "$@"
# shellcheck disable=2068
command lf $@
else
[ ! -d "$HOME/.cache/lf" ] && mkdir --parents "$HOME/.cache/lf"
# shellcheck disable=2016
command lf -command 'set_previewer sixel' "$@" 3>&-
# shellcheck disable=2016,2068
command lf -command 'set_previewer sixel' $@ 3>&-
fi

View file

@ -37,10 +37,9 @@ sub trashed_files ( $search_path, $trash_path ) {
sub fzf_files (@files) {
my $n = 0;
my $str;
my $str = "";
for my $e (@files) {
$str .= "\n" if $n > 0;
$str .= "$n | $$e[2] | $$e[1]";
$str = "$n | $$e[2] | $$e[1]\n" . $str;
$n++;
}
chomp($str);