Last active
June 22, 2021 06:59
-
-
Save benitogf/bfd3ff248f421126dcae19b8a191f199 to your computer and use it in GitHub Desktop.
PowerShell profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://superuser.com/questions/1199882/powershell-auto-complete-settings | |
# https://stackoverflow.com/questions/8264655/how-to-make-powershell-tab-completion-work-like-bash | |
# https://github.com/PowerShell/PSReadLine/blob/master/PSReadLine/SamplePSReadLineProfile.ps1 | |
# https://gist.github.com/jchandra74/5b0c94385175c7a8d1cb39bc5157365e | |
# https://www.hanselman.com/blog/HowToMakeAPrettyPromptInWindowsTerminalWithPowerlineNerdFontsCascadiaCodeWSLAndOhmyposh.aspx | |
# to install dependencies run from pwshell: | |
# Install-Module posh-git -Scope CurrentUser | |
# Install-Module oh-my-posh -Scope CurrentUser | |
# Install-Module -Name 'Get-ChildItemColor' -Scope CurrentUser | |
# Install-Module -Name PSReadLine -Scope CurrentUser -Force -SkipPublisherCheck -AllowClobber | |
# then copy this file in the profile: | |
# notepad.exe $PROFILE | |
# then install a font like: https://github.com/microsoft/cascadia-code/releases?WT.mc_id=-blog-scottha and enable it in the terminal settings | |
Import-Module posh-git | |
Import-Module oh-my-posh | |
Import-Module PSReadLine | |
Set-PSReadLineKeyHandler -Key Tab -Function Complete | |
# Ensure that Get-ChildItemColor is loaded | |
Import-Module Get-ChildItemColor | |
# Set l and ls alias to use the new Get-ChildItemColor cmdlets | |
Set-Alias l Get-ChildItemColor -Option AllScope | |
Set-Alias ll Get-ChildItemColor -Option AllScope | |
Set-Alias ls Get-ChildItemColorFormatWide -Option AllScope | |
Set-PSReadLineOption -HistorySearchCursorMovesToEnd | |
# Helper function to show Unicode character | |
function U | |
{ | |
param | |
( | |
[int] $Code | |
) | |
if ((0 -le $Code) -and ($Code -le 0xFFFF)) | |
{ | |
return [char] $Code | |
} | |
if ((0x10000 -le $Code) -and ($Code -le 0x10FFFF)) | |
{ | |
return [char]::ConvertFromUtf32($Code) | |
} | |
throw "Invalid character code $Code" | |
} | |
# https://github.com/microsoft/terminal/issues/9237#issuecomment-798913706 | |
Set-PoshPrompt Agnoster |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment