Skip to content

Instantly share code, notes, and snippets.

@Longhanks
Created March 24, 2023 07:46
Show Gist options
  • Save Longhanks/2c4b59ed7cb8e275a9a315344b52eef3 to your computer and use it in GitHub Desktop.
Save Longhanks/2c4b59ed7cb8e275a9a315344b52eef3 to your computer and use it in GitHub Desktop.
function ExaL {
exa --long --group --classify --time-style=long-iso --all --all $args
}
New-Alias -Name l -Value ExaL
function ExaLA {
exa --long --group --classify --time-style=long-iso --all $args
}
New-Alias -Name la -Value ExaLA
function ExaLL {
exa --long --group --classify --time-style=long-iso $args
}
New-Alias -Name ll -Value ExaLL
function ExaLSA {
exa --long --group --classify --time-style=long-iso --all --all $args
}
New-Alias -Name lsa -Value ExaLSA
function GitStatus {
git status
}
New-Alias -Name gst -Value GitStatus
function GitCheckout {
git checkout $args
}
New-Alias -Name gco -Value GitCheckout
function DotDot {
Set-Location ..
}
New-Alias -Name .. -Value DotDot
function DotDotDot {
Set-Location ..\..
}
New-Alias -Name ... -Value DotDotDot
function DotDotDotDot {
Set-Location ..\..\..
}
New-Alias -Name .... -Value DotDotDotDot
function DotDotDotDotDot {
Set-Location ..\..\..\..
}
New-Alias -Name ..... -Value DotDotDotDotDot
Set-PSReadlineKeyHandler -Key Ctrl+d -Function DeleteCharOrExit
Set-PSReadLineOption -HistorySearchCursorMovesToEnd:$true
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineKeyHandler -Chord UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Chord DownArrow -Function HistorySearchForward
function prompt {
$loc = Get-Location
return $(
if (Test-Path variable:/PSDebugContext) {
'[DBG]: '
}
else {
''
}
) +
"[$(hostname)] " +
$(
if ("$loc".StartsWith($env:USERPROFILE)) {
"~" + "$loc".Substring($env:USERPROFILE.Length)
}
else {
$loc
}
) +
$(
if ("$(git rev-parse --is-inside-work-tree)" -eq "true") {
if ("$(git rev-parse --abbrev-ref --symbolic-full-name HEAD)" -eq "HEAD") {
" [$([char]27)[34m$($(git --no-optional-locks rev-parse HEAD).Substring(0, 8))$([char]27)[0m]"
} else {
" [$([char]27)[34m$(git symbolic-ref --short HEAD)$([char]27)[0m]"
}
}
else {
''
}
) +
$(
if ($NestedPromptLevel -ge 1) {
' >>'
}
) +
' > ' +
$(
if ($loc.Provider.Name -eq "FileSystem") {
"$([char]27)]9;9;`"$($loc.ProviderPath)`"$([char]27)\"
}
else {
''
}
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment