config-dump/nushell/completions.nu
2025-07-15 21:32:09 +02:00

46 lines
1.1 KiB
Text

$env.config.completions = {
algorithm: prefix
sort: smart
case_sensitive: false
quick: true
partial: true
use_ls_colors: true
external: {
enable: true
max_results: 10
completer: {|spans: list<string>|
# if the current command is an alias, get it's expansion
let expanded_alias = (scope aliases | where name == $spans.0 | get -i 0 | get -i expansion)
# overwrite
let spans = (if $expanded_alias != null {
# put the first word of the expanded alias first in the span
$spans | skip 1 | prepend ($expanded_alias | split row " " | take 1)
} else {
$spans | skip 1 | prepend ($spans.0)
})
carapace $spans.0 nushell ...$spans
| from json
}
}
}
$env.config.menus ++= [
{
marker: $"(ansi yellow)┣ "
name: completion_menu
only_buffer_difference: false
style: {
description_text: yellow
selected_text: red_reverse
text: yellow
}
type: {
col_padding: 2
col_width: 20
columns: 1
layout: columnar
}
}
]