安装 scoop
> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser # Optional: Needed to run a remote script the first time
> irm get.scoop.sh | iex
安装 git node
scoop install git
scoop bucket add extras
scoop install nodejs
scoop bucket add versions
scoop install vscode
安装 rust 环境
scoop install gcc-llvm
scoop install rustup
安装 github
scoop install gh
安装前端环境
npm i -g pnpm yarn tyarn
美化 powershell
scoop install zlocation
scoop install posh-git
scoop install winget
winget install --id Microsoft.Powershell --source winget
scoop install lsd
scoop install psreadline
scoop install terminal-icons
scoop install fzf
scoop install psfzf
编辑配置文件
code $PROFILE
文件内容
# set PowerShell to UTF-8
[console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
Import-Module ZLocation
Import-Module posh-git
Import-Module -Name Terminal-Icons
oh-my-posh init pwsh --config C:\Users\wasd2\scoop\apps\oh-my-posh\current\themes/ys.omp.json | Invoke-Expression
Set-PSReadLineKeyHandler -Chord 'Ctrl+d' -Function DeleteChar
#设置预测文本来源为历史记录
$PSReadLineOptions = @{
EditMode = "Emacs"
BellStyle = "None"
PredictionSource = "History"
HistoryNoDuplicates = $true
HistorySearchCursorMovesToEnd = $true
Colors = @{
Command = [ConsoleColor]::Gray
Number = [ConsoleColor]::DarkGreen
Member = [ConsoleColor]::DarkMagenta
Operator = [ConsoleColor]::DarkBlue
Type = [ConsoleColor]::DarkRed
Variable = [ConsoleColor]::DarkYellow
Parameter = [ConsoleColor]::DarkGreen
ContinuationPrompt = [ConsoleColor]::Gray
Default = [ConsoleColor]::White
Emphasis = [ConsoleColor]::Gray
Error = [ConsoleColor]::DarkRed
Selection = [ConsoleColor]::Gray
Comment = [ConsoleColor]::DarkCyan
Keyword = [ConsoleColor]::DarkRed
String = [ConsoleColor]::Gray
InlinePrediction = [ConsoleColor]::DarkRed
}
}
Set-PSReadLineOption @PSReadLineOptions
# Fzf
Import-Module PSFzf
Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+f' -PSReadlineChordReverseHistory 'Ctrl+d'
# Alias
Set-Alias ll ls
Set-Alias g git
Set-Alias y tyarn
Set-Alias grep findstr
# Utilities
function which ($command) {
Get-Command -Name $command -ErrorAction SilentlyContinue |
Select-Object -ExpandProperty Path -ErrorAction SilentlyContinue
}