commit 84c4ab973a1431d96fa73036257185248dd94ac9
parent 52df28cfe88e01cab2a3235c382083c1f2b44154
Author: Toni Brown <me@tb148.eu.org>
Date: Thu, 16 Oct 2025 19:16:32 +0800
use fish for shell completion
Diffstat:
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/config.nu b/config.nu
@@ -1,6 +1,22 @@
$env.config.buffer_editor = 'hx'
$env.config.show_banner = false
-$env.CARAPACE_BRIDGES = 'zsh,fish,bash,inshellisense'
+$env.config.completions.external = {
+ enable: true
+ max_results: 100
+ completer: {|spans|
+ fish --command $"complete '--do-complete=($spans | str replace --all "'" "\\'" | str join ' ')'"
+ | from tsv --flexible --noheaders --no-infer
+ | rename value description
+ | update value {|row|
+ let value = $row.value
+ let need_quote = ['\' ',' '[' ']' '(' ')' ' ' '\t' "'" '"' "`"] | any { $in in $value }
+ if ($need_quote and ($value | path exists)) {
+ let expanded_path = if ($value starts-with ~) { $value | path expand --no-symlink } else { $value }
+ $'"($expanded_path | str replace --all "\"" "\\\"")"'
+ } else { $value }
+ }
+ }
+}
$env.EDITOR = 'hx'
$env.SHELL = 'nu'
$env.UID = $'(id -u)'
diff --git a/home.nix b/home.nix
@@ -49,7 +49,7 @@
dprint
eslint
ffmpeg
- fish # as a carapace bridge
+ fish
gtkwave
iosevka-bin
iverilog
@@ -74,8 +74,6 @@
programs.bat.enable = true;
- programs.carapace.enable = true;
-
programs.direnv.enable = true;
programs.fastfetch.enable = true;