From 2d0afe54a7a042168b6f5e9d1576905cb401750e Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 18 Sep 2021 00:42:20 +0200 Subject: [PATCH] Add regex_mv and paru alias --- functions/paru.fish | 3 +++ functions/regex_mv.fish | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 functions/paru.fish create mode 100644 functions/regex_mv.fish diff --git a/functions/paru.fish b/functions/paru.fish new file mode 100644 index 0000000..eadcf03 --- /dev/null +++ b/functions/paru.fish @@ -0,0 +1,3 @@ +function paru --description 'alias paru paru --sudoloop' + command paru --sudoloop $argv; +end diff --git a/functions/regex_mv.fish b/functions/regex_mv.fish new file mode 100644 index 0000000..caaebee --- /dev/null +++ b/functions/regex_mv.fish @@ -0,0 +1,29 @@ +function regex_mv + + echo_progress "Find: " + echo_highlight "$argv[1]" + echo + + echo_progress "Replace with: " + echo_highlight "$argv[2]" + echo + + echo + + for old in (ls) + set new (echo $old | sed -r "s/$argv[1]/$argv[2]/g") + echo_progress "$old → " + echo_highlight "$new" + echo + end + + if not confirm + return 1 + end + + for old in (ls) + set new (echo $old | sed -r "s/$argv[1]/$argv[2]/g") + mv "$old" "$new" + end + +end