From c41b346b6f15a8bf8fff7cf31b625fb6049f9667 Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Mon, 4 Apr 2022 11:12:41 -0400 Subject: [PATCH] Add logger function to fish config --- home.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/home.nix b/home.nix index 7fca305..bffa607 100644 --- a/home.nix +++ b/home.nix @@ -24,12 +24,25 @@ # Setup our aliases shellAliases = { ls = "exa --icons"; + cat = "bat"; }; # Custom configuration interactiveShellInit = '' # Setup any-nix-shell any-nix-shell fish --info-right | source + # Load logger function + source ~/.config/fish/functions/cmdlogger.fish ''; + functions = { + # Setup command logging to ~/.logs + cmdlogger = { + onEvent = "fish_preexec"; + body = '' + mkdir -p ~/.logs + echo (date -u +"%Y-%m-%dT%H:%M:%SZ")" "(echo %self)" "(pwd)": "$argv >> ~/.logs/(hostname)-(date "+%Y-%m-%d").log + ''; + }; + }; }; # Starship, for the prompt programs.starship = {