Skip to content

Instantly share code, notes, and snippets.

@Azanniel
Last active March 24, 2024 19:02
Show Gist options
  • Save Azanniel/46f8689d5645b54a4c763473cb1d34cb to your computer and use it in GitHub Desktop.
Save Azanniel/46f8689d5645b54a4c763473cb1d34cb to your computer and use it in GitHub Desktop.
Profile Powershell
# Aumenta a capacidade do armazenamento de histórico de comandos
$MaximumHistoryCount = 20000
# Inicia o startship para dar o visual ao prompt
Invoke-Expression (&starship init powershell)
# Inicializa os módulos
Import-Module PSReadLine
Import-Module posh-git
Import-Module -Name Terminal-Icons
Import-Module DockerCompletion
# Específico para o chocolatey após suas instalação
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
# Habilita o tab para autocomplete
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
# Definições do histórico de comandos
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
Set-PSReadLineOption -ShowToolTips
Set-PSReadLineOption -PredictionSource History
# Aliases -> Atalhos para determinados comandos
Set-Alias which Get-Command # Verifica se o programa existe, se existir lança o nome do caminho
Set-Alias open Invoke-Item # Abre o windows explorer com o caminho especificado
# Aliases Functions -> Funções úteis
function la() { Get-ChildItem | Format-Wide }
function lb() { Get-ChildItem | Format-List }
function md5() { Get-FileHash -Algorithm MD5 $args }
function sha1() { Get-FileHash -Algorithm SHA1 $args }
function sha256() { Get-FileHash -Algorithm SHA256 $args }
function sha512() { Get-FileHash -Algorithm SHA512 $args }
function tail() { Get-Content $args -Tail 30 -Wait }
function take() {
New-Item -ItemType directory $args
Set-Location "$args"
}
function touch() { New-Item -ItemType file $args }
# Limpa o terminal
Clear-Host
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment