Files
TerminalPolyjuice/pwsh/HowToUse.md
2025-05-22 15:29:51 +08:00

2.0 KiB

Install PSReadLine

Execute following the instruction in powershell to install PSReadLine and enable IntelliSense

Install-Module -Name PSReadLine -AllowClobber -Force
Set-PSReadLineOption -PredictionSource History

Emacs mode

Add the following line into $PROFILE

Set-PSReadLineOption -EditMode Emacs

Command Not Found

Add the following line into $PROFILE

Import-Module -Name Microsoft.WinGet.CommandNotFound

Starship

Enable Starship in $PROFILE

Invoke-Expression (&starship init powershell)

Create symbolic link $HOME\.config\starship.toml point to $HOME\.TerminalPolyjuice\starship\starship.toml

New-Item -ItemType SymbolicLink -Path "$HOME\.config\starship.toml" -Target "$HOME\.TerminalPolyjuice\starship\starship.toml"

Zoxide

First, install fzf;

Second, install zoxide;

Then,

Invoke-Expression (& { (zoxide init powershell | Out-String) })

Interactive cd using fzf

function INTERECTIVE_CD {gci -Directory -Recurse | select -expandproperty FullName | fzf}
Set-Alias cdi INTERECTIVE_CD

ctrl-t; ctrl-r

First, install PSFzf module

Install-Module -Name PSFzf

Then, add the following line into $PROFILE

Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+t' -PSReadlineChordReverseHistory 'Ctrl+r'

Oh-My-Posh

Copy *.omp.json to $env:POSH_THEMES_PATH Edit $PROFILE and add

oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/powerlevel10k_rainbow_eip.omp.json" | Invoke-Expression

at the top.

$PROFILE File All In One

Invoke-Expression (&starship init powershell)
Invoke-Expression (& { (zoxide init powershell | Out-String) })

Set-PSReadLineOption -EditMode Emacs

Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+t' -PSReadlineChordReverseHistory 'Ctrl+r'

function INTERACTIVE_CD {gci -Directory -Recurse | select -expandproperty FullName | fzf}
Set-Alias cdi INTERACTIVE_CD