diff --git a/home-manager/shared/shell/helix/default.nix b/home-manager/shared/shell/helix/default.nix index 5e13503..32a2672 100644 --- a/home-manager/shared/shell/helix/default.nix +++ b/home-manager/shared/shell/helix/default.nix @@ -20,24 +20,21 @@ pkgs.writeText "run_jupyter_from_helix.zsh" '' #! ~/.nix-profile/bin/zsh - function is_new() { - new=true; + is_new() { + new=1; touch /tmp/rjh; - cat /tmp/rjh | while read line - do - if [$(pwd) = line]; then - new=false; + while IFS="" read -r p || [ -n "$p" ]; do + if [ $(pwd) = $p ]; then + new=0; fi - done - echo new; + done < /tmp/rjh + return $new } - function send_to_jupyter() { - if $(is_new); then - zellij run -f -n "jupyter console" -- direnv exec . jupyter console --kernel="$1" -f="/tmp/rjh-$(pwd | tr \"/\" -).json" --ZMQTerminalInteractiveShell.include_other_output=True --ZMQTerminalInteractiveShell.other_output_prefix=\'\' - pwd >> /tmp/rjh - fi - zellij write 29 25 # send ctr + w + send_to_jupyter() { + is_new && zellij run -f -n "jupyter console" -- direnv exec . jupyter console --kernel="$1" -f="/tmp/rjh-$(pwd | tr \"/\" -).json" --ZMQTerminalInteractiveShell.include_other_output=True --ZMQTerminalInteractiveShell.other_output_prefix=''' && zellij action write 29 25 + pwd >> /tmp/rjh + zellij action write 29 25 cat | just send } send_to_jupyter