]> Sergey Matveev's repositories - nnn.git/commitdiff
Respect NNN_TRASH in .nmv
authorKlzXS <klzx+github@klzx.cf>
Sun, 13 Feb 2022 09:37:21 +0000 (10:37 +0100)
committerKlzXS <klzx+github@klzx.cf>
Sun, 13 Feb 2022 09:37:21 +0000 (10:37 +0100)
plugins/.nmv

index bf07b10f28b85ee22c70e6013fcadc4544e2f70a..fe747668fc91291511b32272429a28a3382a8211 100755 (executable)
@@ -23,6 +23,15 @@ INCLUDE_HIDDEN="${INCLUDE_HIDDEN:-0}"
 VERBOSE="${VERBOSE:-0}"
 RECURSIVE="${RECURSIVE:-0}"
 
+case "$NNN_TRASH" in
+       1)
+               RM_UTIL="trash-put" ;;
+       2)
+               RM_UTIL="gio trash" ;;
+       *)
+               RM_UTIL="rm -ri" ;;
+esac
+
 selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
 exit_status=0
 
@@ -164,7 +173,7 @@ done <"$dst_file"
 
 unset "items[0]"
 for item in "${items[@]}"; do
-       rm -ri "$item"
+       $RM_UTIL "$item"
 done
 
 rm "$dst_file"