Skip to content

Instantly share code, notes, and snippets.

@sheepla
Last active October 13, 2023 09:38
Show Gist options
  • Save sheepla/6246a8862ca9eb43bc87b59e237f0278 to your computer and use it in GitHub Desktop.
Save sheepla/6246a8862ca9eb43bc87b59e237f0278 to your computer and use it in GitHub Desktop.
Set-PSReadlineOption -EditMode Emacs
Set-PSReadlineOption -BellStyle None
Set-PSReadlineOption -PredictionSource History
Get-Alias | Where-Object {$_.Name -match "[a-z]+"} | Remove-Alias -Force
Set-Alias mv Move-Item
Set-Alias cp Copy-Item
Set-Alias kill Stop-Process
Set-Alias ps Get-Process
Set-Alias rm Remove-Item
Set-Alias g git
Set-Alias cls Clear-Host
Set-Alias clear Clear-Host
Set-Alias c Clear-Host
function Test-Command {
param (
[string[]] $Path
)
return $null -ne (Get-Command -ErrorAction:SilentlyContinue $Path)
}
if (Test-Command lsd) {
Set-Alias ls lsd
function local:lsda() { lsd -FA }
Set-Alias l lsda
function local:lsdal() { lsd -FAl }
Set-Alias ll lsdl
}
if (Test-Command zoxide) {
# zoxide
Invoke-Expression (& { $hook = if ($PSVersionTable.PSVersion.Major -ge 6) { 'pwd' } else { 'prompt' } (zoxide init powershell --hook $hook | Out-String) })
Set-Alias cd z
} else {
Set-Alias cd Set-Location
}
# starship
if (Test-Command starship) {
starship init powershell | Invoke-Expression
}
if (Test-Command bat) {
Set-Alias cat bat
}
if (Test-Command @("fd", "gof")) {
function cdf {
fd --type d | gof | Set-Location
}
}
if (Test-Command starship) {
Invoke-Expression -Command (gh completion --shell powershell | Out-String)
}
Import-Module psfzf -Scope Local -ErrorAction SilentlyContinue
Import-Module posh-git -Scope Local -ErrorAction SilentlyContinue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment