aboutsummaryrefslogtreecommitdiff
path: root/modules/terminal/system/programs/fish.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/terminal/system/programs/fish.nix')
-rw-r--r--modules/terminal/system/programs/fish.nix26
1 files changed, 26 insertions, 0 deletions
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