From e7ab2e1c7701f14d1da7525131e0263bd14a2403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Av=C3=A9?= Date: Fri, 14 Jun 2024 18:54:59 +0000 Subject: [PATCH] Fri Jun 14 06:54:59 PM UTC 2024 --- home/Mallorea.nix | 5 +++++ home/Vault.nix | 4 ++++ home/zsh/default.nix | 5 +++++ home/zsh/files/keys.zsh | 15 +++++++-------- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/home/Mallorea.nix b/home/Mallorea.nix index 3212b13..db9dedf 100644 --- a/home/Mallorea.nix +++ b/home/Mallorea.nix @@ -72,4 +72,9 @@ in LANG = "en_US.UTF-8"; XDG_RUNTIME_DIR = "/run/user/$(id -u)"; }; + + programs.zsh.initExtra = '' + LOCAL_SEARCH_DIRS=(~/.dotfiles/ ~/Containers ~/Workspace ~/Storage/Thomas ~/Storage/Shared) + REMOTE_SEARCH_DIRS=() + ''; } diff --git a/home/Vault.nix b/home/Vault.nix index 196123e..12563f1 100644 --- a/home/Vault.nix +++ b/home/Vault.nix @@ -71,4 +71,8 @@ in XDG_RUNTIME_DIR = "/run/user/$(id -u)"; }; + programs.zsh.initExtra = '' + LOCAL_SEARCH_DIRS=(~/.dotfiles/ ~/Storage/Thomas/ ~/Storage/Etienne/ ~/Storage/Magda\ and\ Etienne/ ~/Containers/) + REMOTE_SEARCH_DIRS=() + ''; } diff --git a/home/zsh/default.nix b/home/zsh/default.nix index b755de3..83fa458 100644 --- a/home/zsh/default.nix +++ b/home/zsh/default.nix @@ -44,6 +44,11 @@ syntaxHighlighting.enable = false; autosuggestion.enable = true; + initExtra = pkgs.lib.mkDefault '' + LOCAL_SEARCH_DIRS=(~/.dotfiles/) + REMOTE_SEARCH_DIRS=(~/Workspace/ /home/server/Storage/Shared/ /home/server/Storage/Thomas/) + ''; + initExtraFirst = '' ZVM_VI_INSERT_ESCAPE_BINDKEY=jj source ${./files/waypipe.zsh} diff --git a/home/zsh/files/keys.zsh b/home/zsh/files/keys.zsh index de9a0c1..70a1356 100644 --- a/home/zsh/files/keys.zsh +++ b/home/zsh/files/keys.zsh @@ -27,15 +27,14 @@ function find_global() { fi if [ ! -f $FZY_CACHE ]; then PATHS="" - search_dirs=(~/.dotfiles/ ~/Workspace/ ~/Containers/ /home/server/Storage/Thomas/) - for i in "$search_dirs[@]"; do + for i in "$LOCAL_SEARCH_DIRS[@]"; do if [ -d $i ]; then - PATHS="$PATHS\n$i" - if [ "$(hostname)" = "mallorea" ]; then - PATHS+="\n$(fd . $i -t $file_type -d 8)" - else - PATHS+="\n$(ssh mallorea fd . $i -t $file_type -d 8)" - fi + PATHS="$PATHS\n$i\n$(fd . $i -t $file_type -d 8)" + fi + done + for i in "$REMOTE_SEARCH_DIRS[@]"; do + if [ -d $i ]; then + PATHS="$PATHS\n$i\n$(ssh mallorea fd . $i -t $file_type -d 8)" fi done echo -e "$PATHS" > $FZY_CACHE