From 53c94c46ee9d6847cd7154b321541a8becab55df Mon Sep 17 00:00:00 2001 From: chn Date: Sun, 9 Jul 2023 22:44:59 +0800 Subject: [PATCH] enable br --- modules/home/zsh.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/home/zsh.nix b/modules/home/zsh.nix index 5f3ad59e..e9b0cb4e 100644 --- a/modules/home/zsh.nix +++ b/modules/home/zsh.nix @@ -10,6 +10,21 @@ HYPHEN_INSENSITIVE="true" export PATH=~/bin:$PATH + + function br + { + local cmd cmd_file code + cmd_file=$(mktemp) + if broot --outcmd "$cmd_file" "$@"; then + cmd=$(<"$cmd_file") + command rm -f "$cmd_file" + eval "$cmd" + else + code=$? + command rm -f "$cmd_file" + return "$code" + fi + } ''; plugins = [