Skip to content

Instantly share code, notes, and snippets.

@RenanLazarotto
Last active June 18, 2024 15:13
Show Gist options
  • Save RenanLazarotto/1d55097d5a6d8e3fe07972d42711ff97 to your computer and use it in GitHub Desktop.
Save RenanLazarotto/1d55097d5a6d8e3fe07972d42711ff97 to your computer and use it in GitHub Desktop.
PowerShell profile and Starship config
# Funções para os aliases
# Navega até a pasta de projetos
function Enter-Projects {
Set-Location "~/Projetos"
}
# Abre o nano que vem junto com o Git
function Invoke-Nano {
& "C:\Program Files\Git\usr\bin\nano.exe" $args
}
# Converte um vídeo para WEBM - útil para as evidências
function Convert-ToWebm {
Param(
[Parameter(Mandatory = $true)]
[string] $File
)
# Caminho completo até o arquivo de entrada
$FullPath = [io.path]::GetFullPath($File)
# Nome do arquivo de saída
$OutFile = [io.path]::GetFileNameWithoutExtension($File)
# Pasta de saída
$OutDirectory = [io.path]::GetDirectoryName($FullPath)
ffmpeg -i "$FullPath" -c:v libvpx-vp9 -b:v 0 -crf 20 -pass 1 -an -f null NUL && ffmpeg -i "$FullPath" -c:v libvpx-vp9 -b:v 0 -crf 20 -pass 2 -c:a libopus "$OutDirectory\$OutFile.webm"
if (Test-Path ".\ffmpeg2pass-0.log") {
Remove-Item ".\ffmpeg2pass-0.log"
}
}
# Definições de aliases
Set-Alias l ls
Set-Alias cdw Enter-Projects
Set-Alias nano Invoke-Nano
Set-Alias webm Convert-ToWebm
# Inicia o Starship
Invoke-Expression (& 'C:\Program Files\Starship\bin\starship.exe' init powershell --print-full-init | Out-String)
format = """
[λ ](fg:half_life)\
$directory\
$git_branch\
$nodejs\
$golang\
\n$character\
"""
palette = "halflife"
[palettes.halflife]
light_gray = "#858585"
half_life = "#FF6000"
windows = "#0078D4"
node = "#5FA04E"
go = "#00ADD8"
git = "#F05032"
[directory]
style = "fg:windows"
format = "[ $path ]($style)"
truncation_length = 6
truncation_symbol = "…/"
truncate_to_repo = false
home_symbol = "󰜥 "
[directory.substitutions]
"Documents" = "󰈙 "
"Downloads" = " "
"Music" = " "
"Pictures" = " "
[git_branch]
format = "[ $symbol $branch ](fg:git)"
symbol = ""
[nodejs]
symbol = "󰎙"
format = "[ $symbol $version ](fg:node)"
[golang]
symbol = ""
format = "[ $symbol $version ](fg:go)"
[character]
success_symbol = "[❯](bold green)"
error_symbol = "[×](bold red)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment