From 3981482362931c995bc814c3e4441628b86980f1 Mon Sep 17 00:00:00 2001 From: Collin Williams <96917990+bluedragon1221@users.noreply.github.com> Date: Mon, 9 Jun 2025 20:24:27 +0000 Subject: broot is quick! --- modules/terminal/system/programs/fish.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'modules/terminal/system/programs/fish.nix') diff --git a/modules/terminal/system/programs/fish.nix b/modules/terminal/system/programs/fish.nix index 89d26ef..7501251 100644 --- a/modules/terminal/system/programs/fish.nix +++ b/modules/terminal/system/programs/fish.nix @@ -6,6 +6,14 @@ }: let cfg = config.collinux.terminal.shells.fish; + scripts.cool-cd = pkgs.writeShellScriptBin "cd.sh" '' + if git rev-parse --is-inside-work-tree; then + cd $(fd . "$(git rev-parse --show-toplevel)" --type dir | fzf) + else + cd $(fd . --type dir | fzf) + fi + ''; + init = pkgs.writeText "config.fish" '' set fish_greeting @@ -13,6 +21,20 @@ ${pkgs.starship}/bin/starship module character end + function cool-cd + if git rev-parse --is-inside-work-tree &>/dev/null + set dirs (fd . (git rev-parse --show-toplevel) --type dir) + else + set dirs (fd . --type dir) + end + + if test -z "$dirs" + exit + end + + cd (echo "$dirs" | fzf) + end + if status is-interactive alias cat bat @@ -22,6 +44,10 @@ ${pkgs.fzf}/bin/fzf --fish | source ${pkgs.starship}/bin/starship init fish | source + ${pkgs.broot}/bin/broot --print-shell-function fish | source + + # extra bindings + bind 'alt-c' cool-cd enable_transience -- cgit v1.3.1