argc -> carapace
This commit is contained in:
+1
-2
@@ -25,8 +25,7 @@ yay -S wezterm nushell urxvt-resize-font
|
|||||||
chsh -s /usr/bin/nu
|
chsh -s /usr/bin/nu
|
||||||
|
|
||||||
# nushell
|
# nushell
|
||||||
yay -S oh-my-posh argc
|
yay -S oh-my-posh carapace-bin
|
||||||
git clone https://github.com/sigoden/argc-completions.git ~/.local/share/argc-completions/
|
|
||||||
oh-my-posh init nu --config https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/refs/heads/main/themes/peru.omp.json
|
oh-my-posh init nu --config https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/refs/heads/main/themes/peru.omp.json
|
||||||
|
|
||||||
# code
|
# code
|
||||||
|
|||||||
+24
-6
@@ -92,9 +92,27 @@ def monitor [
|
|||||||
|
|
||||||
source ~/.oh-my-posh.nu
|
source ~/.oh-my-posh.nu
|
||||||
|
|
||||||
# argc-completions
|
let carapace_completer = {|spans|
|
||||||
$env.ARGC_COMPLETIONS_ROOT = '/home/hjalmarlucius/.local/share/argc-completions'
|
carapace $spans.0 nushell ...$spans | from json
|
||||||
$env.ARGC_COMPLETIONS_PATH = ($env.ARGC_COMPLETIONS_ROOT + '/completions/linux:' + $env.ARGC_COMPLETIONS_ROOT + '/completions')
|
# carapace doesn't give completions if you don't give it any additional
|
||||||
$env.PATH = ($env.PATH | prepend ($env.ARGC_COMPLETIONS_ROOT + '/bin'))
|
# args
|
||||||
argc --argc-completions nushell | save -f '/home/hjalmarlucius/.local/share/argc-completions/tmp/argc-completions.nu'
|
mut spans = $spans
|
||||||
source '/home/hjalmarlucius/.local/share/argc-completions/tmp/argc-completions.nu'
|
if ($spans | is-empty) {
|
||||||
|
$spans = [""]
|
||||||
|
}
|
||||||
|
|
||||||
|
carapace $spans.0 nushell ...$spans | from json
|
||||||
|
# sort by color
|
||||||
|
| sort-by {
|
||||||
|
let fg = $in | get -i style.fg
|
||||||
|
let attr = $in | get -i style.attr
|
||||||
|
|
||||||
|
# the ~ there to make "empty" results appear at the end
|
||||||
|
$"($fg)~($attr)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$env.config.completions.external = {
|
||||||
|
enable: true
|
||||||
|
max_results: 100
|
||||||
|
completer: $carapace_completer
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user