Last active
January 20, 2021 10:53
-
-
Save mimukit/d0378bd473d0abd3c49cac497459887f to your computer and use it in GitHub Desktop.
Powershell configuration for windows 10
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
# 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 ls Get-ChildItemColorFormatWide -Option AllScope | |
# Helper functions | |
# Show Unicode characters | |
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" | |
} | |
# Create file with unix like command 'touch' | |
function touch([string]$fileName) { | |
New-Item $PWD\$fileName; | |
} | |
# Ensure posh-git is loaded | |
Import-Module -Name posh-git | |
# Ensure oh-my-posh is loaded | |
Import-Module -Name oh-my-posh | |
# Set the default prompt theme | |
Set-Theme CustomAgnoster | |
# Set command history config | |
Set-PSReadlineOption -HistoryNoDuplicates | |
Set-PSReadLineOption -HistorySearchCursorMovesToEnd | |
# history substring search | |
Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward | |
Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward | |
# Tab completion | |
Set-PSReadlineKeyHandler -Chord 'Shift+Tab' -Function Complete | |
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete | |
# Set default user | |
$DefaultUser = 'mukit' | |
# Set custom functions | |
function open {Invoke-Item .} | |
function config {code $PROFILE} | |
# Set git alias | |
function gst {git status} | |
function glo {git log --oneline} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment