1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-31 20:17:45 +00:00

Revert "Use carapace properly"

This reverts commit 8aad332ab9.
This commit is contained in:
RGBCube 2023-12-13 07:22:35 +03:00
parent f8dec535fb
commit 96a2cc3a5d
No known key found for this signature in database
2 changed files with 47 additions and 2 deletions

View file

@ -124,7 +124,49 @@ $env.config.completions = {
partial: true
quick: true
external: {
enable: true
max_results: 100
completer: {|tokens: list<string>|
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
}
}
}
}

View file

@ -1,11 +1,10 @@
{ config, ulib, pkgs, upkgs, theme, ... }: with ulib; merge
{ config, ulib, pkgs, upkgs, theme, ... }: with ulib; merge3
(systemConfiguration {
users.defaultUserShell = pkgs.nushell;
})
(homeConfiguration {
programs.carapace = enabled {};
programs.starship = enabled {};
programs.nushell = enabled {
@ -32,3 +31,7 @@
};
};
})
(homePackages (with pkgs; [
carapace
]))