From 8aad332ab9358fe005582dbab3d50dc2d94053e4 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Wed, 13 Dec 2023 00:39:46 +0300 Subject: [PATCH] Use carapace properly --- modules/nushell/configuration.nix.nu | 42 ---------------------------- modules/nushell/default.nix | 7 ++--- 2 files changed, 2 insertions(+), 47 deletions(-) diff --git a/modules/nushell/configuration.nix.nu b/modules/nushell/configuration.nix.nu index 0ee524c..52d091b 100644 --- a/modules/nushell/configuration.nix.nu +++ b/modules/nushell/configuration.nix.nu @@ -124,49 +124,7 @@ $env.config.completions = { partial: true quick: true external: { - enable: true max_results: 100 - completer: {|tokens: list| - let expanded_alias = scope aliases | where name == $tokens.0 | get --ignore-errors expansion.0 - - let tokens = if $expanded_alias != null { - $expanded_alias | split row " " | append ($tokens | skip 1) - } else { - $tokens - } - - let command = $tokens.0 | str trim --left --char "^" - - let completions = carapace $command nushell $tokens | from json | default [] - - if ($completions | is-empty) { - let path = $tokens | last - - ls $"($path)*" | each {|it| - let choice = if ($path | str ends-with "/") { - $path | path join ($it.name | path basename) - } else { - $path | path dirname | path join ($it.name | path basename) - } - - let choice = if ($it.type == "dir") and (not ($choice | str ends-with "/")) { - $"($choice)/" - } else { - $choice - } - - if ($choice | str contains " ") { - $"`($choice)`" - } else { - $choice - } - } - } else if ($completions | where value =~ "^.*ERR$" | is-empty) { - $completions - } else { - null - } - } } } diff --git a/modules/nushell/default.nix b/modules/nushell/default.nix index 0afdd66..09873d5 100644 --- a/modules/nushell/default.nix +++ b/modules/nushell/default.nix @@ -1,10 +1,11 @@ -{ config, ulib, pkgs, upkgs, theme, ... }: with ulib; merge3 +{ config, ulib, pkgs, upkgs, theme, ... }: with ulib; merge (systemConfiguration { users.defaultUserShell = pkgs.nushell; }) (homeConfiguration { + programs.carapace = enabled {}; programs.starship = enabled {}; programs.nushell = enabled { @@ -31,7 +32,3 @@ }; }; }) - -(homePackages (with pkgs; [ - carapace -]))