aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2022-09-01 23:13:09 -0500
committerMatthew Bauer <mjbauer95@gmail.com>2022-09-01 23:16:55 -0500
commitbd63ae7e18f649e22ace799e6d366efe4029dc80 (patch)
treef007eefa464f0dd322647fe7934e8ef6357b3927
parentddb82ffda993d237d62d59578f7808a9d98c77fe (diff)
Don’t add a space after attrs completion in zsh
This matches the behavior of bash. We don’t want to add a space after completion on attrs. Uses -S. Switches to new compadd style comppletions instead of _describe. Shouldn’t have any negative issues from what I can tell.
-rw-r--r--misc/zsh/completion.zsh13
1 files changed, 7 insertions, 6 deletions
diff --git a/misc/zsh/completion.zsh b/misc/zsh/completion.zsh
index e702c721e..e86984168 100644
--- a/misc/zsh/completion.zsh
+++ b/misc/zsh/completion.zsh
@@ -10,14 +10,15 @@ function _nix() {
local -a suggestions
declare -a suggestions
for suggestion in ${res:1}; do
- # FIXME: This doesn't work properly if the suggestion word contains a `:`
- # itself
- suggestions+="${suggestion/ /:}"
+ suggestions+=("${suggestion%% *}")
done
+ local -a args
if [[ "$tpe" == filenames ]]; then
- compadd -f
+ args+=('-f')
+ elif [[ "$tpe" == attrs ]]; then
+ args+=('-S' '')
fi
- _describe 'nix' suggestions
+ compadd -J nix "${args[@]}" -a suggestions
}
-_nix "$@"
+# _nix "$@"