项目作者: r3nanp

项目描述 :
✨ My personal configuration using Powershell, PSReadline and oh-my-posh for theming.
高级语言: PowerShell
项目地址: git://github.com/r3nanp/my-powershell-config.git
创建时间: 2020-12-06T20:08:32Z
项目社区:https://github.com/r3nanp/my-powershell-config

开源协议:MIT License

下载


🔥 My Powershell Config

My Windows Powershell configuration with oh-my-posh and PSReadline.

r3nanp
license mit



Prerequisites

You should use a modern console host like ConEmu, Alacritty, Terminus, Hyper, FluentTerminal, or the official Windows Terminal to have a great terminal experience on Windows. ⚠

Techologies used

How to active the scripts execution in Powershell?

  • This command will show which policy is active
    1. Get-ExecutionPolicy

Policy table
| Restriced | AllSigned | RemoteSigned | Unrestriced | ByPass |
|———————————————————————————————————————— |——————————————————————————- |———————————————————————————————————————— |—————————————————————————————————————————————————————- |——————————————————————————— |
| No script can be run. Windows Powershell can only be used in interactive mode. | Only scripts signed by a trusted publisher can run. | Download scripts must be signed by a trusted publisher before they can be run. | No restrictions. All scripts can be run, but download scripts will prompt for permission before it runs. | All scripts can be run, without warnings or prompts. |


Example: My Powershell is using RemoteSigned policy

Hyper

  • This command will change your policy:
    1. Set-ExecutionPolicy -Scope CurrentUser RemoteSigned

How to install PSReadline and oh-my-posh

  • Install PSReadline
  1. Install-Module -Name PSReadLine -AllowPrerelease -Scope CurrentUser -Force -SkipPublisherCheck
  • If you don’t have an -AllowPrerelease flag, upgrade PowerShellGet with:
  1. Install-Module -Name PowerShellGet -Force first.
  • Install oh-my-posh
  1. Install-Module oh-my-posh -Scope CurrentUser

(Not necessary)

  • Install Get-ChildItemColor
  1. Install-Module -Name Get-ChildItemColor -AllowPrerelease -Scope CurrentUser -Force -SkipPublisherCheck -AllowClobber

Configure Powershell profile

  • Into your powershell, execute this command:
  1. if (!(Test-Path -Path $PROFILE )) {
  2. New-Item -Type File -Path $PROFILE -Force
  3. }
  4. # To open in visual studio code, but you can change it
  5. code $PROFILE

And copy and paste profile configuration in theme