From f55198f27b074b7d96f67598b5a2be29c70a78b2 Mon Sep 17 00:00:00 2001 From: Antoine Vaure Date: Tue, 21 Apr 2026 11:14:21 +0200 Subject: [PATCH] better rm to trash conversion --- home/fish.nix | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/home/fish.nix b/home/fish.nix index 6b09ff5..5fa2182 100644 --- a/home/fish.nix +++ b/home/fish.nix @@ -66,6 +66,21 @@ ffsum.body = '' ${pkgs.ffmpeg}/bin/ffmpeg -hide_banner -v error $argv[..-2] -i $argv[-1] -map 0:v -f md5 - ''; + rm.body = '' + if type -q trash + trash $argv + else + if not test $TRASH_MESSAGE_PRINTED + echo (set_color blue)"trash-cli not installed! Falling back to using unforgiving rm"(set_color reset) + set -gx TRASH_MESSAGE_PRINTED 1 + end + if type -q /usr/bin/rm + /usr/bin/rm $argv + else + ${pkgs.coreutils}/bin/rm $argv + end + end + ''; }; shellAliases = { @@ -74,7 +89,6 @@ grep = "grep --color=auto"; diff = "diff --color=auto"; dev = "nix develop -c fish"; - rm = "trash"; del = "rm -rf"; rsyncp = "rsync --info=progress2 --no-inc-recursive"; ffmpeg = "ffmpeg -hide_banner";