aboutsummaryrefslogtreecommitdiff
path: root/modules/terminal/system
diff options
context:
space:
mode:
Diffstat (limited to 'modules/terminal/system')
-rw-r--r--modules/terminal/system/default.nix1
-rw-r--r--modules/terminal/system/programs/broot.nix28
-rw-r--r--modules/terminal/system/programs/fish.nix26
3 files changed, 55 insertions, 0 deletions
diff --git a/modules/terminal/system/default.nix b/modules/terminal/system/default.nix
index d5cd1f5..b31fe90 100644
--- a/modules/terminal/system/default.nix
+++ b/modules/terminal/system/default.nix
@@ -14,6 +14,7 @@ in {
./programs/lazygit.nix
./programs/starship.nix
./programs/tmux.nix
+ ./programs/broot.nix
];
programs.command-not-found.enable = false; # broken without nix-channels
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