From 782602667b4156b991fea7075b2a26a40e4ffc86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20La=C3=ADn?= Date: Sat, 18 Nov 2023 18:13:20 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20perf(fish):=20changed=20logic=20?= =?UTF-8?q?of=20repos=20script=20and=20now=20is=20faster?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .config/fish/functions/cdzi.fish | 3 ++- .config/fish/functions/repos.fish | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.config/fish/functions/cdzi.fish b/.config/fish/functions/cdzi.fish index 47a09aab..2f1f0f6c 100644 --- a/.config/fish/functions/cdzi.fish +++ b/.config/fish/functions/cdzi.fish @@ -2,7 +2,8 @@ function cdzi --description 'Open directories from zoxide in a new Kitty tab' set selected_dir (zi) if test -n "$selected_dir" - cd $selected_dir + set tab_title (basename "$selected_dir") + set new_tab_cmd "kitty @ set-tab-title \"$tab_title\"; and cd $selected_dir" else commandline -f repaint end diff --git a/.config/fish/functions/repos.fish b/.config/fish/functions/repos.fish index e8f2bc88..e606ef94 100644 --- a/.config/fish/functions/repos.fish +++ b/.config/fish/functions/repos.fish @@ -1,9 +1,9 @@ function repos --description 'Open Git directories in ~/Repos with fzf in a new Kitty tab' - set selected_dir (fd --type d --base-directory ~/Repos/ -H '^\.git$' -d 4 | sd '\.git/' '' | fzf) + set selected_dir (find ~/Repos -type d -exec test -e '{}/.git' ';' -print -prune | fzf) if test -n "$selected_dir" set tab_title (basename "$selected_dir") - set new_tab_cmd "kitty @ launch --type=tab --tab-title \"$tab_title\" ~/Repos/$selected_dir" + set new_tab_cmd "kitty @ set-tab-title \"$tab_title\"; and cd $selected_dir" eval $new_tab_cmd end