Simplify zsh completion install

This commit is contained in:
Chad Wade Day, Jr 2020-07-26 10:37:20 -07:00
parent dd86c8a691
commit d7361cdc31
No known key found for this signature in database
GPG Key ID: 9041D7756B13B2DB
2 changed files with 22 additions and 7 deletions

View File

@ -1,36 +1,50 @@
# Installation # Installation
## Bash completions ## Bash completions
### Prerequisites ### Prerequisites
**yadm** completion only works if Git completions are also enabled. **yadm** completion only works if Git completions are also enabled.
### Homebrew ### Homebrew
If using `homebrew` to install **yadm**, completions should automatically be handled if you also install `brew install bash-completion`. This might require you to include the main completion script in your own bashrc file like this:
``` If using `homebrew` to install **yadm**, completions should automatically be
handled if you also install `brew install bash-completion`. This might require
you to include the main completion script in your own bashrc file like this:
```bash
[ -f /usr/local/etc/bash_completion ] && source /usr/local/etc/bash_completion [ -f /usr/local/etc/bash_completion ] && source /usr/local/etc/bash_completion
``` ```
### Manual installation ### Manual installation
Copy the completion script locally, and add this to you bashrc: Copy the completion script locally, and add this to you bashrc:
```
```bash
[ -f /full/path/to/yadm.bash_completion ] && source /full/path/to/yadm.bash_completion [ -f /full/path/to/yadm.bash_completion ] && source /full/path/to/yadm.bash_completion
``` ```
## Zsh completions ## Zsh completions
### Homebrew ### Homebrew
If using `homebrew` to install **yadm**, completions should handled automatically. If using `homebrew` to install **yadm**, completions should handled automatically.
### Manual installation ### Manual installation
Copy the completion script `yadm.zsh_completion` locally, rename it to `_yadm`, and add the containing folder to `$fpath` in `.zshrc`:
``` Add the `completion/zsh` folder to `$fpath` in `.zshrc`:
fpath=(/path/to/folder/containing_yadm $fpath)
```zsh
fpath=(/full/path/to/yadm/completion/zsh $fpath)
autoload -U compinit autoload -U compinit
compinit compinit
``` ```
### Installation using [zplug](https://github.com/b4b4r07/zplug) ### Installation using [zplug](https://github.com/b4b4r07/zplug)
Load `_yadm` as a plugin in your `.zshrc`: Load `_yadm` as a plugin in your `.zshrc`:
```
```zsh
fpath=("$ZPLUG_HOME/bin" $fpath) fpath=("$ZPLUG_HOME/bin" $fpath)
zplug "TheLocehiliosan/yadm", rename-to:_yadm, use:"completion/yadm.zsh_completion", as:command, defer:2 zplug "TheLocehiliosan/yadm", rename-to:_yadm, use:"completion/yadm.zsh_completion", as:command, defer:2
``` ```

1
completion/zsh/_yadm Symbolic link
View File

@ -0,0 +1 @@
yadm.zsh_completion