To enable tab completion, run the following command:
hop completions <shell> > /some/path/to/hop-completion
<shell> is one of
If you get permission denied error, you can try running the following command:
# pipe output to sudo tee and do not output to the tty
$ hop completions <shell> | sudo tee /some/path/to/hop-completion > /dev/null
The commands above will output the completion script to the specified path. Which will look something like this:
$ hop completions zsh
autoload -U is-at-least
typeset -A opt_args
typeset -a _arguments_options
The correct method of installing a completion script can depend on both your shell and your configuration.
Completions typically will be installed automatically by your shell’s package manager and the script will try to install them.
This example shows how to enable tab completion for zsh, it assumes you are
$ hop completions zsh > ~/.oh-my-zsh/completions/_hop
Your completion script must have the name in the format of _ followed by the name of the application.
oh-my-zsh, you will need to add a path for completion scripts to your
function path, and turn on completion script autoloading. First, add these lines
autoload -U compinit
Next, create a directory at
~/.zsh/completion and copy the completion script
to the new directory.
If you have bash-completion
installed, you can just copy your new completion script to the
directory using the following command:
$ hop completions bash > /usr/local/etc/bash_completion.d/hop
Without bash-completion, you will need to source the completion script directly.
Copy it to a directory such as
~/.bash_completions/, and then add the
following line to
$ source ~/.bash_completions/hop
To enable tab completion for fish, copy the completion script to the
/usr/share/fish/completions directory using
the following command:
$ hop completions fish > ~/.config/fish/completions/hop.fish