From 397ff8381fe80a67d87113e94a6c7be663191e85 Mon Sep 17 00:00:00 2001 From: Daniel Bulant Date: Sun, 6 Apr 2025 22:32:10 +0200 Subject: [PATCH] working onefetch in nu --- .config/nushell/base-config.nu | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.config/nushell/base-config.nu b/.config/nushell/base-config.nu index 3e87269..2e19095 100644 --- a/.config/nushell/base-config.nu +++ b/.config/nushell/base-config.nu @@ -288,7 +288,14 @@ export-env { pre_prompt: [{ null }] # run before the prompt is shown pre_execution: [{ null }] # run before the repl input is run env_change: { - PWD: [{ |before, after| if (ls -la | where name == ".git" | is-not-empty) { onefetch } }] # run if the PWD environment is different since the last repl input + PWD: [{ + |before, after| + # runs on startup + if (($before | is-not-empty) and (ls -la | where name == ".git" | is-not-empty)) { + # output to stdout in hooks is unreliable, use `print` + print (onefetch) + } + }] } display_output: { table } # run before the output of a command is drawn, example: `{ if (term size).columns >= 100 { table -e } else { table } }` command_not_found: { null } # return an error message when a command is not found