diff options
Diffstat (limited to 'modules/terminal/system/programs')
| -rw-r--r-- | modules/terminal/system/programs/broot.nix | 28 | ||||
| -rw-r--r-- | modules/terminal/system/programs/fish.nix | 26 |
2 files changed, 54 insertions, 0 deletions
diff --git a/modules/terminal/system/programs/broot.nix b/modules/terminal/system/programs/broot.nix new file mode 100644 index 0000000..ed86822 --- /dev/null +++ b/modules/terminal/system/programs/broot.nix @@ -0,0 +1,28 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.terminal.shells.fish; + toml' = pkgs.formats.toml {}; + + conf = toml'.generate "conf.toml" { + verbs = [ + { + invocation = "edit"; + key = "enter"; + execution = "${pkgs.helix}/bin/hx {file}"; + } + ]; + }; +in + lib.mkIf cfg.enable { + hjem.users."${config.collinux.user.name}" = { + files = { + ".config/broot/conf.toml".source = conf; + }; + + packages = [pkgs.broot]; + }; + } 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 |
