Skip to content

Powershell Settings

Quick Commands

  • Open the current folder:
    explorer .
    
  • Open the current folder in VS Code:
    code .
    

Git

Install git from git-scm.

SSH

Gererate ssh key by the following command:

ssh-keygen

Vim

  1. Install by the following command:

    winget install Vim.Vim
    

  2. Add vim path:

    [Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Program Files\Vim\vim82", [EnvironmentVariableTarget]::User)
    

Oh My Posh

  1. Install by the following command:
    winget install JanDeDobbeleer.OhMyPosh
    
  2. Enable ps1 file execution:

    • Check the current execution policy:
      Get-ExecutionPolicy -List
      
    • Set the execution policy for the current user:
      Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
      
  3. Add profile:

    • Create the folder:
      New-Item -ItemType Directory -Force -Path (Split-Path $PROFILE)
      
    • Check if the profile file exists:
      Test-Path $PROFILE
      
    • Edit the profile file:
      vim $PROFILE
      
    • Add the following content to the profile file:
      oh-my-posh init pwsh | Invoke-Expression
      
      # Better history & completion
      Import-Module PSReadLine
      Set-PSReadLineOption -PredictionSource History
      
PowerShell Too Old

If you get the error, it might be because your PowerShell version is too old. You can check your PowerShell version by running:

Install-Module PSReadLine -Force -Scope CurrentUser

# Check Oh My Posh version
$PSVersionTable.PSVersion