Skip to content

nocd

nocd prevents Zinit from changing the current directory into the plugin’s directory when evaluating hook ices (atinit'', atload'', atclone'', atpull'').

Terminal window
zi ice nocd

By default, when any of the at* hooks execute, the working directory is the plugin’s local directory. nocd disables this cd so hooks run from whatever directory the shell is currently in.

This is useful when hooks reference files by absolute path and a cd would be undesired or when the hook must run relative to $PWD.

nocd is a flag ice — it takes no value.

Terminal window
# Run atload without cding into the plugin directory
zi ice wait lucid nocd atload"export MY_VAR=$PWD"
zi light some/plugin
  • atinit
  • atload
  • atclone
  • atpull