From bbf06248683ff65a1f90be55f8dd4552657e9d5c Mon Sep 17 00:00:00 2001
From: Peder Bergebakken Sundt <pbsds@hotmail.com>
Date: Thu, 20 Mar 2025 13:33:08 +0100
Subject: [PATCH] ldaslkjdsalkjadslkj

---
 users/pbsds/home/profiles/bashrc.d/zeditor-remote.sh | 5 +++++
 users/pbsds/home/profiles/shell.nix                  | 3 +--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/users/pbsds/home/profiles/bashrc.d/zeditor-remote.sh b/users/pbsds/home/profiles/bashrc.d/zeditor-remote.sh
index aafebbe..f9d1103 100644
--- a/users/pbsds/home/profiles/bashrc.d/zeditor-remote.sh
+++ b/users/pbsds/home/profiles/bashrc.d/zeditor-remote.sh
@@ -105,6 +105,11 @@ zeditor-remote() {
     if [[ "$?" -eq 130 ]]; then
       return 1 # ctrl-c
     fi
+    if command -v direnv >/dev/null; then
+      # TODO: need i find a way to load the direnv on remotes?
+      # https://github.com/zed-industries/zed/issues/4977#issuecomment-2536680602
+      zed_cmd="direnv exec ${choice} $zed_cmd"
+    fi
     # history -s "${zed_cmd}"
     eval ${zed_cmd}
     printf >&2 "%s\n" "+$(printf " %q" cd "${choice}")"
diff --git a/users/pbsds/home/profiles/shell.nix b/users/pbsds/home/profiles/shell.nix
index 822fd6a..acd10fb 100644
--- a/users/pbsds/home/profiles/shell.nix
+++ b/users/pbsds/home/profiles/shell.nix
@@ -3,8 +3,7 @@
 let
 
   _tmp_func_name = "_tmp_func_Oaw5aifeeniezeiquonaipheNahthae9caik4Rai"; # pwgen ftw
-  # TODO: trap the 'unset'?
-  mkArgsAlias = alias: ''${_tmp_func_name}() { ${alias}; unset -f ${_tmp_func_name}; }; ${_tmp_func_name}'';
+  mkArgsAlias = alias: ''${_tmp_func_name}() { unset -f ${_tmp_func_name}; ${alias}; }; ${_tmp_func_name}'';
 
 in