image.png

安装 scoop

  1. > Set-ExecutionPolicy RemoteSigned -Scope CurrentUser # Optional: Needed to run a remote script the first time
  2. > irm get.scoop.sh | iex

安装 git node

  1. scoop install git
  2. scoop bucket add extras
  3. scoop install nodejs
  4. scoop bucket add versions
  5. scoop install vscode

安装 rust 环境

  1. scoop install gcc-llvm
  2. scoop install rustup

安装 github

  1. scoop install gh

安装前端环境

  1. npm i -g pnpm yarn tyarn

美化 powershell

  1. scoop install zlocation
  2. scoop install posh-git
  3. scoop install winget
  4. winget install --id Microsoft.Powershell --source winget
  5. scoop install lsd
  6. scoop install psreadline
  7. scoop install terminal-icons
  8. scoop install fzf
  9. scoop install psfzf

编辑配置文件

  1. code $PROFILE

文件内容

  1. # set PowerShell to UTF-8
  2. [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
  3. Import-Module ZLocation
  4. Import-Module posh-git
  5. Import-Module -Name Terminal-Icons
  6. oh-my-posh init pwsh --config C:\Users\wasd2\scoop\apps\oh-my-posh\current\themes/ys.omp.json | Invoke-Expression
  7. Set-PSReadLineKeyHandler -Chord 'Ctrl+d' -Function DeleteChar
  8. #设置预测文本来源为历史记录
  9. $PSReadLineOptions = @{
  10. EditMode = "Emacs"
  11. BellStyle = "None"
  12. PredictionSource = "History"
  13. HistoryNoDuplicates = $true
  14. HistorySearchCursorMovesToEnd = $true
  15. Colors = @{
  16. Command = [ConsoleColor]::Gray
  17. Number = [ConsoleColor]::DarkGreen
  18. Member = [ConsoleColor]::DarkMagenta
  19. Operator = [ConsoleColor]::DarkBlue
  20. Type = [ConsoleColor]::DarkRed
  21. Variable = [ConsoleColor]::DarkYellow
  22. Parameter = [ConsoleColor]::DarkGreen
  23. ContinuationPrompt = [ConsoleColor]::Gray
  24. Default = [ConsoleColor]::White
  25. Emphasis = [ConsoleColor]::Gray
  26. Error = [ConsoleColor]::DarkRed
  27. Selection = [ConsoleColor]::Gray
  28. Comment = [ConsoleColor]::DarkCyan
  29. Keyword = [ConsoleColor]::DarkRed
  30. String = [ConsoleColor]::Gray
  31. InlinePrediction = [ConsoleColor]::DarkRed
  32. }
  33. }
  34. Set-PSReadLineOption @PSReadLineOptions
  35. # Fzf
  36. Import-Module PSFzf
  37. Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+f' -PSReadlineChordReverseHistory 'Ctrl+d'
  38. # Alias
  39. Set-Alias ll ls
  40. Set-Alias g git
  41. Set-Alias y tyarn
  42. Set-Alias grep findstr
  43. # Utilities
  44. function which ($command) {
  45. Get-Command -Name $command -ErrorAction SilentlyContinue |
  46. Select-Object -ExpandProperty Path -ErrorAction SilentlyContinue
  47. }