Files
copnix/modules/home/nu/home-nushell-completions.ulu.nix
T
2026-08-23 18:03:02 +03:00

69 lines
1.8 KiB
Nix

{ ... }:
{
flake.homeModules.home-nushell-completions =
{ pkgs, lib, ... }:
let
inherit (lib.meta) getExe;
carapaceNu = pkgs.runCommand "carapace.nu" { } ''
${getExe pkgs.carapace} _carapace nushell > $out
'';
in
{
home.packages = [ pkgs.carapace ];
programs.nushell.environmentVariables.CARAPACE_BRIDGES = "zsh,fish,bash";
programs.nushell.extraConfig = ''
let menus = [
{
name: completion_menu
only_buffer_difference: false
marker: ($env.PROMPT_INDICATOR? | default "> ")
type: {
layout: ide
min_completion_width: 0
max_completion_width: 150
max_completion_height: 25
padding: 0
border: false
cursor_offset: 0
description_mode: "prefer_right"
min_description_width: 0
max_description_width: 50
max_description_height: 10
description_offset: 1
correct_cursor_pos: true
}
style: {
text: white
selected_text: white_reverse
description_text: yellow
match_text: { attr: u }
selected_match_text: { attr: ur }
}
}
{
name: history_menu
only_buffer_difference: true
marker: ($env.PROMPT_INDICATOR? | default "> ")
type: {
layout: list
page_size: 10
}
style: {
text: white
selected_text: white_reverse
}
}
]
$env.config.menus = $env.config.menus
| where name not-in ($menus | get name)
| append $menus
source ${carapaceNu}
'';
};
}