Skip to main content

hook

Call one of omni's hooks for the shell.

init​

The init hook will provide you with the command to run to initialize omni in your shell.

Parameters​

ParameterRequiredValue typeDescription
shellnoenum: zsh, bash or fishThe shell for which to provide the shell integration; defaults to the value of SHELL environment variable, or bash otherwise.
--alias <alias>nostringAdds <alias> as a shell alias to the omni command, with autocompletion support; can be repeated.
--command-alias <alias> <subcommand>nostring, stringAdds <alias> as a shell alias to the omni <subcommand> command, with autocompletion support; can be repeated.
--shimsnonullOnly load the shims without setting up the dynamic environment.
--keep-shimsnonullKeep the shims in the path, instead of removing them when setting up the dynamic environment.
--print-shims-pathnonullPrint the path to the shims directory and exit immediately. Will not initialize omni's environment for the current shell.

Examples​

# While specifying the shell
eval "$(omni hook init bash)" # for bash
eval "$(omni hook init zsh)" # for zsh
omni hook init fish | source # for fish

# If not specifying the shell, the login shell, as reflected by the `SHELL`
# environment variable, is used
eval "$(omni hook init)"
omni hook init | source

# With 'o' as an omni alias
eval "$(omni hook init --alias o)"
omni hook init --alias o | source

# With 'ocd' as an alias to 'omni cd'
eval "$(omni hook init --command-alias ocd cd)"
omni hook init --command-alias ocd cd | source

# Only load the shims
eval "$(omni hook init bash --shims)" # for bash
eval "$(omni hook init zsh --shims)" # for zsh
omni hook init fish --shims | source # for fish

env​

The env hook is called during your shell prompt or before executing a shim to set the dynamic environment for omni up-ed repositories.

uuid​

The uuid hook provides and alternative to uuidgen, in case it is not installed, so that omni can work without extra dependencies.