1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-11 00:10:08 +00:00

feat(nvm): add pnpx as lazy cmd

This commit is contained in:
Carlo Sala 2024-08-28 10:34:25 +02:00
parent efe21261d0
commit a3dfe29036
No known key found for this signature in database
GPG key ID: DA6FB450C1A4FE9A
2 changed files with 5 additions and 4 deletions

View file

@ -26,9 +26,10 @@ These settings should go in your zshrc file, before Oh My Zsh is sourced:
#### Lazy startup #### Lazy startup
This option will help you to defer nvm's load until you use it to speed-up your zsh startup. This will source This option will help you to defer nvm's load until you use it to speed-up your zsh startup. This will source
nvm script only when using it, and will create a function for `node`, `npm`, `npx`, `pnpm`, `yarn`, `corepack` nvm script only when using it, and will create a function for `node`, `npm`, `npx`, `pnpm`, `pnpx`, `yarn`,
and the command(s) specified by `lazy-cmd` option, so when you call either of them, nvm will be loaded and run `corepack` and the command(s) specified by `lazy-cmd` option, so when you call either of them, nvm will be
with default version. To enable it, you can add this snippet to your zshrc, before Oh My Zsh is sourced: loaded and run with default version. To enable it, you can add this snippet to your zshrc, before Oh My Zsh is
sourced:
```zsh ```zsh
zstyle ':omz:plugins:nvm' lazy yes zstyle ':omz:plugins:nvm' lazy yes

View file

@ -74,7 +74,7 @@ function _omz_setup_autoload {
if zstyle -t ':omz:plugins:nvm' lazy; then if zstyle -t ':omz:plugins:nvm' lazy; then
# Call nvm when first using nvm, node, npm, pnpm, yarn, corepack or other commands in lazy-cmd # Call nvm when first using nvm, node, npm, pnpm, yarn, corepack or other commands in lazy-cmd
zstyle -a ':omz:plugins:nvm' lazy-cmd nvm_lazy_cmd zstyle -a ':omz:plugins:nvm' lazy-cmd nvm_lazy_cmd
nvm_lazy_cmd=(nvm node npm npx pnpm yarn corepack $nvm_lazy_cmd) # default values nvm_lazy_cmd=(nvm node npm npx pnpm pnpx yarn corepack $nvm_lazy_cmd) # default values
eval " eval "
function $nvm_lazy_cmd { function $nvm_lazy_cmd {
for func in $nvm_lazy_cmd; do for func in $nvm_lazy_cmd; do