From 87b30db073936b4830fd1e534d8c380db5fb403c Mon Sep 17 00:00:00 2001 From: Suleyman Farajli Date: Mon, 3 Nov 2025 23:59:02 +0400 Subject: fix(lf): remove files that have spaces in them --- config/lf/lfrc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'config/lf') diff --git a/config/lf/lfrc b/config/lf/lfrc index 40b6272..fa4e307 100644 --- a/config/lf/lfrc +++ b/config/lf/lfrc @@ -32,17 +32,20 @@ set rulerfmt "\033[32;1;7m" set promptfmt "\033[48;1;234m %w/%f" +# Use a custom separator to safely split filenames that contain spaces. +set filesep " / " + cmd trash ${{ set -f mkdir -p ~/.trash - for entry in $fx; do - trash_path=~/.trash/$(basename -- "${entry}") + echo "$fx" | sed 's/ \/ /\n/g' | while IFS= read -r file; do + tmp=~/.trash/$(basename -- "${file}") + trash_path=$(printf '%s' "$tmp" | tr ' ' '_') if [ -e "${trash_path}" ]; then printf '%s exists\n' "${trash_path}" >&2 trash_path="${trash_path}_$(date +%s)_$RANDOM" printf 'moving to %s\n' "${trash_path}" >&2 fi - - mv -- "${entry}" "${trash_path}" + mv -- "${file}" "${trash_path}" done }} -- cgit v1.2.3