Skip to content
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

allow to use as a plugin by e.g. OMZ #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shadarim
Copy link

@shadarim shadarim commented Jan 6, 2023

Hi,

I added a file to integrate with a config as aplugin.
It just adds the path where the completions are to $fpath.
It is then automatically picked up by compinit (assuming $fpath contains our dir before the call to compinit)

This is how zsh-completions plugin does it as well: link

Installation:

git clone https://github.com/rsherstnev/zshcompletions.git /random/path/where//your/completions/live

# then in .zshrc
source /random/path/where/your/completions/live/zsh-cyber-completions.plugin.zsh
#...
autoload -Uz compinit && compinit

Or for OMZ:


git clone https://github.com/rsherstnev/zshcompletions.git ${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-cyber-completions

# then in .zshrc

# do not add to plugins=(...)
fpath+="${ZSH_CUSTOM:-"$ZSH/custom"}/plugins/zsh-cyber-completions"

# source OMZ after $fpath is updated - otherwise compinit is called twice
source "$ZSH/oh-my-zsh.sh"

This saves the trouble of having to move files arround and running compinit multiple times:

Put it in /usr/share/zsh/functions/Completion/Unix/
Add in your zshrc file line compinit /usr/share/zsh/functions/Completion/Unix/*

Anyway the zsh completions coming with the installation are normally there (/usr/share/zsh/functions/Completion/Unix/) and owned by root. So I'd rather have my additional completions (either from other users or written by me) somewhere else.

I hope this helps.

BR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant