Thanks @jo-totland for the solution. I modified the condition to use automatically provided environment variable CHEZMOI_OS
(source). Because the original answer uses uninitialized $isWindows
variable.
If ($env:CHEZMOI_OS -eq "windows") {
If (-Not (Test-Path $env:LOCALAPPDATA\nvim)) {
New-Item -Path $env:LOCALAPPDATA\nvim -ItemType Junction -Value $env:USERPROFILE\.config\nvim
}
}
Just for the reference, there's an open issue about this on GitHub: https://github.com/twpayne/chezmoi/issues/2273
I wanted to post it as a comment under the original answer, but don't have enough reputation :\