Skip to content

Commit

Permalink
change fpath instructions to be more broad (#936)
Browse files Browse the repository at this point in the history
Co-authored-by: Joyce Fee <[email protected]>
  • Loading branch information
Deflaimun and Feediver1 authored Dec 20, 2024
1 parent 5f1ad50 commit 0da2f05
Showing 1 changed file with 22 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,38 @@ rpk generate shell-completion bash > /etc/bash_completion.d/rpk

== Zsh

To enable autocompletion in any zsh session for any user, run this once:
To enable autocompletion in any zsh session for any user, follow these steps:

[,bash]
Determine which directory in your `$fpath` to use to store the completion file.

You can inspect your `fpath` by running:
[,zsh]
----
rpk generate shell-completion zsh > "${fpath[1]}/_rpk"
echo $fpath
----

You can also place that command in your `~/.zshrc` to ensure that when you update
`rpk`, you update autocompletion. If you initially require `sudo` to edit that
file, you can `chmod` it to be world writeable, after which you will always be
able to update it from `~/.zshrc`.
Choose one of the directories listed. For example, if `/usr/local/share/zsh/site-functions` is present in your `fpath`, you can place the `_rpk` completion file there:

If shell completion is not already enabled in your zsh environment, also
add the following to your `~/.zshrc`:
[,zsh]
----
rpk generate shell-completion zsh > /usr/local/share/zsh/site-functions/_rpk
----

If the directory you chose is not already in `fpath`, add it to your `.zshrc`:
[,zsh]
----
autoload -U compinit; compinit
fpath+=(/usr/local/share/zsh/site-functions)
----

Finally, ensure that `compinit` is run. Add (or verify) the following in your `.zshrc`:

[,zsh]
----
autoload -U compinit && compinit
----

After restarting your shell, `rpk` completion should be active.

== Fish

To enable autocompletion in any `fish` session, run:
Expand Down

0 comments on commit 0da2f05

Please sign in to comment.