How to do it...

Ensure that the profile is empty. If you just created the profile, you can simply proceed further. If not, clear all contents in the profile. If the error action preference is set in the profile, it would become hard to troubleshoot scripts that you create in the future.

  1. Enter the following in the main window.
function prompt {
$Location = (Get-Location).Path.ToString()
switch -Wildcard ($Location) {
"/home/$env:USERNAME" { $Location = '~'; break }
"/home/$env:USERNAME/Documents" { $Location = 'Documents'; break }
"/home/$env:USERNAME/Downloads" { $Location = 'Downloads'; break }
"/home/$env:USERNAME/Pictures" { $Location = 'Pictures'; break }
"/home/$env:USERNAME/Videos" { $Location = 'Videos'; break }
"/home/$env:USERNAME/Music" { $Location = 'Music'; break }
"/home/$env:USERNAME/Documents/code" { $Location = 'Code'; break }
"/home/$env:USERNAME/*" { $Location = $Location.Replace("/home/$env:USERNAME/", '~/'); break }
Default { }
}
Write-Host "PS " -NoNewline
Write-Host `
($($env:USERNAME) + "@" + "$([System.Net.Dns]::GetHostByName((hostname)).HostName) ") `
-NoNewLine -ForegroundColor Cyan
Write-Host "$Location" -NoNewline -ForegroundColor Green
Write-Host ("`n> ") -NoNewline
return " "
}
  1. Save the profile script file.
  2. Click on the little bin icon at the top of the Integrated Console to kill the current PowerShell session.
  3. When VS Code prompts you whether you would like to restart the session, click Yes.

Your prompt should look as shown in the image below.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.77.114