[feat] Add carapace completer
This commit is contained in:
@@ -1,37 +1,37 @@
|
||||
# Nushell Config File
|
||||
|
||||
let fish_completer = {|spans|
|
||||
fish --command $'complete "--do-complete=($spans | str join " ")"'
|
||||
| $"value(char tab)description(char newline)" + $in
|
||||
| from tsv --flexible --no-infer
|
||||
}
|
||||
# let fish_completer = {|spans|
|
||||
# fish --command $'complete "--do-complete=($spans | str join " ")"'
|
||||
# | $"value(char tab)description(char newline)" + $in
|
||||
# | from tsv --flexible --no-infer
|
||||
# }
|
||||
|
||||
let carapace_completer = {|spans: list<string>|
|
||||
carapace $spans.0 nushell ...$spans
|
||||
| from json
|
||||
| if ($in | default [] | where value =~ '^-.*ERR$' | is-empty) { $in } else { null }
|
||||
}
|
||||
# let carapace_completer = {|spans: list<string>|
|
||||
# carapace $spans.0 nushell ...$spans
|
||||
# | from json
|
||||
# | if ($in | default [] | where value =~ '^-.*ERR$' | is-empty) { $in } else { null }
|
||||
# }
|
||||
|
||||
# This completer will use carapace by default
|
||||
let external_completer = {|spans|
|
||||
let expanded_alias = scope aliases
|
||||
| where name == $spans.0
|
||||
| get -i 0.expansion
|
||||
# # This completer will use carapace by default
|
||||
# let external_completer = {|spans|
|
||||
# let expanded_alias = scope aliases
|
||||
# | where name == $spans.0
|
||||
# | get -i 0.expansion
|
||||
|
||||
let spans = if $expanded_alias != null {
|
||||
$spans
|
||||
| skip 1
|
||||
| prepend ($expanded_alias | split row ' ')
|
||||
} else {
|
||||
$spans
|
||||
}
|
||||
# let spans = if $expanded_alias != null {
|
||||
# $spans
|
||||
# | skip 1
|
||||
# | prepend ($expanded_alias | split row ' ')
|
||||
# } else {
|
||||
# $spans
|
||||
# }
|
||||
|
||||
match $spans.0 {
|
||||
nu => $fish_completer
|
||||
git => $fish_completer
|
||||
_ => $carapace_completer
|
||||
} | do $in $spans
|
||||
}
|
||||
# match $spans.0 {
|
||||
# nu => $fish_completer
|
||||
# git => $fish_completer
|
||||
# _ => $carapace_completer
|
||||
# } | do $in $spans
|
||||
# }
|
||||
|
||||
# For more information on themes, see
|
||||
# https://www.nushell.sh/book/coloring_and_theming.html
|
||||
@@ -293,7 +293,7 @@ $env.config = {
|
||||
external: {
|
||||
enable: true # set to false to prevent nushell looking into $env.PATH to find more suggestions, `false` recommended for WSL users as this look up my be very slow
|
||||
max_results: 100 # setting it lower can improve completion performance at the cost of omitting some options
|
||||
completer: $external_completer
|
||||
# completer: $external_completer
|
||||
}
|
||||
}
|
||||
filesize: {
|
||||
@@ -557,6 +557,7 @@ $env.config = {
|
||||
}
|
||||
|
||||
|
||||
source ~/.cache/carapace/init.nu
|
||||
source starship.nu
|
||||
source zoxide.nu
|
||||
source alias.nu
|
||||
|
||||
@@ -84,3 +84,7 @@ if ($os | str contains Windows) {
|
||||
$env.PATH = ($env.PATH | prepend $"($env.HOME)/.local/vcpkg")
|
||||
}
|
||||
|
||||
$env.CARAPACE_BRIDGES = 'zsh,fish,bash,inshellisense' # optional
|
||||
mkdir ~/.cache/carapace
|
||||
carapace _carapace nushell | save --force ~/.cache/carapace/init.nu
|
||||
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
register /Users/fs0c131y/.local/bin/nu_plugin_from_agp {
|
||||
"sig": {
|
||||
"name": "from agp",
|
||||
"usage": "Parse text as agprefs and create a table.",
|
||||
"extra_usage": "",
|
||||
"search_terms": [],
|
||||
"required_positional": [],
|
||||
"optional_positional": [],
|
||||
"rest_positional": null,
|
||||
"named": [
|
||||
{
|
||||
"long": "help",
|
||||
"short": "h",
|
||||
"arg": null,
|
||||
"required": false,
|
||||
"desc": "Display the help message for this command",
|
||||
"var_id": null,
|
||||
"default_value": null
|
||||
}
|
||||
],
|
||||
"input_output_types": [
|
||||
[
|
||||
"String",
|
||||
{
|
||||
"Table": []
|
||||
}
|
||||
]
|
||||
],
|
||||
"allow_variants_without_examples": false,
|
||||
"is_filter": false,
|
||||
"creates_scope": false,
|
||||
"allows_unknown_args": false,
|
||||
"category": "Formats"
|
||||
},
|
||||
"examples": []
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user