Skip to content

Instantly share code, notes, and snippets.

@the-eric-kwok
Created March 6, 2020 03:15
Show Gist options
  • Save the-eric-kwok/7c04a47aaffd175d12c6dfc59c4632ea to your computer and use it in GitHub Desktop.
Save the-eric-kwok/7c04a47aaffd175d12c6dfc59c4632ea to your computer and use it in GitHub Desktop.
My Powershell Profile
# Better work with oh-my-pwsh
# Put below content into $PROFILE
function su-fun {Start-Process powershell -Verb runAs -argumentlist '-NoExit', "cd '$pwd';", "$args"}
set-alias su su-fun
set-alias sudo su-fun
$env:PYTHONIOENCODING="utf-8"
# Remove curl alias
If (Test-Path Alias:curl) {Remove-Item Alias:curl}
If (Test-Path Alias:curl) {Remove-Item Alias:curl}
function GitLogPretty {
git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all
}
function PrettyLS {
colorls --light -A
}
function GitStat {git status}
function GoBack {Set-Location ..}
function GetMyIp {curl -L tool.lu/ip}
function UpdateScoop {scoop update; scoop update *}
function UpdateChoco {choco upgrade chocolatey}
Import-Module posh-git
Import-Module oh-my-posh
# $DefaultUser = 'spenc'
# Setup other alias
Set-Alias open Invoke-Item
Set-Alias .. GoBack
Set-Alias glola GitLogPretty
Set-Alias gst GitStat
Set-Alias myip GetMyIp
Set-Alias pls PrettyLS
# Set theme
Set-Theme robbyrussell
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment