-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trouble getting zsh completion to work #31
Comments
Hey! Normally you don't eval completions, if i'm not mistaken. About the Not sure which distro you use, but the AUR package does exactly that. It takes the zsh completion (on the folder i mentioned) and copies it to a file named Let me know if that gets you going. |
Actually here's an issue related: #4 |
Hey, thanks for the reply. You were correct about needing to add a symlink to a dir in the Here is how I recommend bootstrapping macOS: #!/usr/bin/env bash
## Recommended ENV vars and paths
CARGO_HOME="$HOME/.local/share/cargo"
FLAVOURS_CONFIG_FILE="$HOME/.config/flavours/config.toml"
FLAVOURS_DATA_DIRECTORY="$HOME/.local/share/flavours"
## May vary by user
SRC_DIRECTORY="$HOME/src/"
COMPLETIONS_DIRECTORY="$HOME/.local/share/zsh/site-functions"
SHELL_PROFILE="$HOME/.config/shell/profile"
## Ensure presence of ENV vars
for var_name in "CARGO_HOME" "FLAVOURS_DATA_DIRECTORY" "FLAVOURS_CONFIG_FILE"; do
if ! grep -q $var_name "$SHELL_PROFILE"; then
# SEE: https://mywiki.wooledge.org/BashFAQ/006#Evaluating_indirect.2Freference_variables
if [[ -n "${ZSH_VERSION:-}" ]]; then
var_value="${(P)var_value}"
elif [[ -n "${BASH_VERSION:-}" ]]; then
var_value="${!var_value}"
fi
# or if you are not opposed to eval...
# eval "var_value=\"\${$var_value}\""
var_value="${var_value/$HOME/\$HOME}"
echo "var_name=\"${var_value}\"" >> "$SHELL_PROFILE"
fi
done
## Ensure presence of directories
for dir in \
"$(dirname $FLAVOURS_CONFIG_FILE)" "$FLAVOURS_DATA_DIRECTORY" \
"$SRC_DIRECTORY" "$COMPLETIONS_DIRECTORY" "$CARGO_HOME"; do
[[ -d "$dir" ]] || mkdir -p "$dir"
done
brew install rust
cargo install flavours
## Add cargo bin dir to PATH
ln -s ../share/cargo/bin/ ~/.local/bin/cargo
## Assumes...
## Make reloading idempotent
# [[ -z "$PATH_ORIGINAL" ]] && export PATH_ORIGINAL=$PATH || export PATH=$PATH_ORIGINAL
## Adds `~/.local/bin` (and all subdirs) to $PATH
# export PATH="${$(find -L ~/.local/bin -type d -print0 | xargs -0n1 -I {} zsh -c 'printf %q: {}')%%:}:$PATH"
flavours update all
## Add zsh completions
[[ -d $COMPLETIONS_DIRECTORY ]] || COMPLETIONS_DIRECTORY="${fpath[1]}"
git clone https://github.com/Misterio77/flavours "$SRC_DIRECTORY/flavours"
ln -s "$SRC_DIRECTORY/flavours/completions/zsh" "$COMPLETIONS_DIRECTORY/_flavours" |
By reading the source code, I found the undocumented feature of
flavours —completions zsh
. But eval-ing it doesn’t work, and redirecting it to a file and sourcing it doesn’t work.Any help would be appreciated. (I have used
bash
since 1995 and just switched tozsh
a few months ago, so I'm out of my element here.)The text was updated successfully, but these errors were encountered: