Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
b5be2d39
Unverified
Commit
b5be2d39
authored
Jun 20, 2023
by
Carlo Sala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(nvm): disable lazy-loading if autoload is set
Closes #11748
parent
4ba17232
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
5 deletions
+16
-5
README.md
plugins/nvm/README.md
+3
-0
nvm.plugin.zsh
plugins/nvm/nvm.plugin.zsh
+13
-5
No files found.
plugins/nvm/README.md
View file @
b5be2d39
...
@@ -43,6 +43,9 @@ zstyle ':omz:plugins:nvm' lazy-cmd eslint prettier typescript ...
...
@@ -43,6 +43,9 @@ zstyle ':omz:plugins:nvm' lazy-cmd eslint prettier typescript ...
#### `.nvmrc` autoload
#### `.nvmrc` autoload
Note: _this option cannot be used at the same time as
`lazy`
.
`autoload`
will override it and load
`nvm`
at
startup._
If set, the plugin will automatically load a node version when if finds a
If set, the plugin will automatically load a node version when if finds a
[
`.nvmrc` file
](
https://github.com/nvm-sh/nvm#nvmrc
)
in the current working directory indicating which node
[
`.nvmrc` file
](
https://github.com/nvm-sh/nvm#nvmrc
)
in the current working directory indicating which node
version to load. This can be done, similar as previous options, adding:
version to load. This can be done, similar as previous options, adding:
...
...
plugins/nvm/nvm.plugin.zsh
View file @
b5be2d39
...
@@ -16,7 +16,18 @@ fi
...
@@ -16,7 +16,18 @@ fi
# Note: nvm is a function so we need to use `which`
# Note: nvm is a function so we need to use `which`
which nvm &>/dev/null
&&
return
which nvm &>/dev/null
&&
return
if
zstyle
-t
':omz:plugins:nvm'
lazy
;
then
if
[[
-z
"
$NVM_DIR
"
]]
;
then
echo
"[oh-my-zsh] nvm installation cannot be found"
echo
"[oh-my-zsh] set NVM_DIR to your installation"
return
fi
if
[[
!
-f
"
$NVM_DIR
/nvm.sh"
]]
;
then
echo
"[oh-my-zsh] nvm.sh does not exist in
$NVM_DIR
"
return
fi
if
zstyle
-t
':omz:plugins:nvm'
lazy
&&
\
!
zstyle
-t
':omz:plugins:nvm'
autoload
;
then
# Call nvm when first using nvm, node, npm, pnpm, yarn or other commands in lazy-cmd
# Call nvm when first using nvm, node, npm, pnpm, yarn 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
eval
"
eval
"
...
@@ -28,11 +39,8 @@ if zstyle -t ':omz:plugins:nvm' lazy; then
...
@@ -28,11 +39,8 @@ if zstyle -t ':omz:plugins:nvm' lazy; then
}
}
"
"
unset
nvm_lazy_cmd
unset
nvm_lazy_cmd
elif
[[
-f
"
$NVM_DIR
/nvm.sh"
]]
;
then
# Load nvm if it exists in $NVM_DIR
source
"
$NVM_DIR
/nvm.sh"
else
else
return
source
"
$NVM_DIR
/nvm.sh"
fi
fi
# Autoload nvm when finding a .nvmrc file in the current directory
# Autoload nvm when finding a .nvmrc file in the current directory
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment