nvs
nvs copied to clipboard
Issue with nvs auto clearing PowerShell prompt
I have the following PowerShell profile:
# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
function Prompt
{
$location = $(get-location)
$host.ui.RawUI.WindowTitle = $location
"${location}>"
}
nvs auto on
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Agnoster
nvs's auto feature does not get enabled somehow. If I then use nvs auto on
, my prompt is replaced with the standard default:
⨯ bytenik@BYTENIK-PC D:\..\..\..\platform-ws dev ≣ nvs auto on
PATH -= $env:LOCALAPPDATA\nvs\node\10.9.0\x64
PATH -= $env:LOCALAPPDATA\nvs\default
PATH += $env:LOCALAPPDATA\nvs\node\13.14.0\x64
D:\Documents\Projects\thinkalpha\platform-ws>
Having similar issues with this clearing out my prompt settings. Specifically my posh-git stuff seemingly gets wiped and I lose context.
nvs auto on
does not seem to work in any case I have tried.
only nvs auto
has worked which is still helpful.
nvs auto on
hooks into PowerShell's prompt function so that it can detect directory changes. It will take some investigation to understand whether it's possible to make that work in a way that plays nicely with posh-git
.
I use starship
which is a custom prompt. With the following profile, they both seem to work fine together.
# Improved prompt
Invoke-Expression (&starship init powershell)
Write-Host -Foreground Green "Initialized Starship."
# Activate nvs after starship to preserve the custom prompt
nvs auto on
@bytenik Did you try moving nvs auto on
to the bottom of your profile?
I can't do that because nvs auto on
clobbers the prompt:
See this copy/paste from my console when I run it:
bytenik@BYTENIK-PC D:\..\..\platform-ws dev ≣ nvs auto on
Adding: node/15/x64
Downloading [#####################################################################################################################################] 100%
Extracting [#####################################################################################################################################] 100%
PATH -= $env:LOCALAPPDATA\nvs\default
PATH += $env:LOCALAPPDATA\nvs\node\15.5.0\x64
D:\Documents\Projects\platform-ws>
I can confirm that the recent version 1.7.0 fixed this issue for me with Starship. nvs does need to be loaded after Starship.