文章目录
- (recommended)the fonts display problems:
- installation tutorial the oh my posh(by the official):
- for specific platform
- Installation (my operation process)
- prepare work:
- (optional) List all themes:
- (recommended) create the "$profile"
- write some content to the "$Profile"file):
- have troubles?(if not ,please pass the part and go on)
- (recommended) posh git
- (A) You've never installed posh-git from the PowerShell Gallery
- (B optional) You've already installed a previous version of posh-git from the PowerShell Gallery
- the configuration result:
- if you want to install by 'scoop':
- scoop install (optional,you can jump!):
- method1 for install scoop:
- or shorter :method2 for install scoop:
- !!Note: if you get an error you might need to change the execution policy (i.e. enable Powershell) with:
(recommended)the fonts display problems:
this is a preparation work.
if you just want to know the solution of the abnormal font problems, than you could jump to the link :
installation tutorial the oh my posh(by the official):
this link is offered by the official:
cross platform powershell:official install tutorial
for specific platform
for windows
Installation (my operation process)
prepare work:
excute:
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
than
Install-Module oh-my-posh -Scope CurrentUser
(optional) List all themes:
You may meet the abnormal fonts display problems.if so ,reference to the link written in the top of the article.
!! you may need import the module before to test the command below
To display every available theme in the current directory, use the following cmdlet.
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
Import-Module oh-my-posh
Get-PoshThemes
(recommended) create the “$profile”
execute:
notepad $PRPFILE
this file just like the .bashrc
file in linux bash shell.
but they have different language syntaxs.
write some content to the "$Profile"file):
according to your need,modify the lines beneth:
#import Module (recommended add the next line,but,of course ,you can choose not to add the item,if you do not use the git tools)
# Import-Module posh-git
# import posh
Import-Module oh-my-posh
#set theme
Set-poshPrompt paradox
#set tab auto completion(optional item)
#(the command line will try to offer you a list(candidated) when you press the `tab`key
#of course,if the current path have only one or even none can match what you want to match,it will just try to complete the current object name
Set-PSReadlineKeyHandler -Key Tab -Function Complete
generally ,the file will be saved in the default location ,like this:C:\Users\cxxu\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
have troubles?(if not ,please pass the part and go on)
if you modify the default the store location,you can run the $Profile
to see the detail location of the $Profile file should be placed.
this maybe also probably happend in the case that you set you onedrive backup include the folder documents
,and onedrive sync folder is set in the disk which is not disk C:
(recommended) posh git
https://github.com/dahlbyk/posh-git/ install in seconds:
Start Windows PowerShell 5.x or PowerShell >= v6 (pwsh).
Execute one of the following two commands from an elevated PowerShell prompt, depending on whether (A) you’ve never installed posh-git, or (B) you’ve already installed a previous version:
(A) You’ve never installed posh-git from the PowerShell Gallery
PowerShellGet\Install-Module posh-git -Scope CurrentUser -Force
NOTE: If you’re asked to trust packages from the PowerShell Gallery, answer yes to continue installation of posh-git
OR
(B optional) You’ve already installed a previous version of posh-git from the PowerShell Gallery
PowerShellGet\Update-Module posh-git
the configuration result:
if you want to install by ‘scoop’:
scoop install (optional,you can jump!):
https://scoop.sh/ Installs in seconds
Make sure PowerShell 5 (or later, include PowerShell Core) and .NET Framework 4.5 (or later) are installed. Then run:
method1 for install scoop:
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
or shorter :method2 for install scoop:
iwr -useb get.scoop.sh | iex
!!Note: if you get an error you might need to change the execution policy (i.e. enable Powershell) with:
Set-ExecutionPolicy RemoteSigned -scope CurrentUser