this repo has no description
dotfiles
at main 107 lines 3.1 kB view raw
1# Fix input/output encoding to be UTF-8 2# This might not be needed on PowerShell Core? 3#$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding 4 5Set-PSReadlineOption -BellStyle None 6# *nix-/bash-like tab complete 7Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete 8 9#Get-Content -Path "$env:USERPROFILE\dotfiles\windows\aliases.ps1" -Raw | Invoke-Expression 10 11Import-Module posh-git 12#Import-Module oh-my-posh 13#Set-Theme Paradox 14Invoke-Expression (&starship init powershell) 15 16$DEFAULT_PGP_KEYID = 'C58C41E27B00AD04' 17 18if (Test-Path 'env:SUBLIME_MERGE_PATH') { 19 Set-Alias -Name smerge -Value $env:SUBLIME_MERGE_PATH 20} 21 22if (Test-Path 'env:MPV_PATH') { 23 Set-Alias -Name mpv -Value $env:MPV_PATH 24} 25 26# if (Test-Path 'env:CODE_INSIDERS_PATH') { 27# Set-Alias -Name code -Value $env:CODE_INSIDERS_PATH 28# } 29 30Set-Alias -Name g -Value git 31Set-Alias -Name vi -Value nvim 32Set-Alias -name vim -Value nvim 33 34function Invoke-Copilot-Shell-Suggestion { 35 [Alias('?s')] 36 param([string] $query) 37 gh copilot suggest -t shell $query 38} 39 40function Invoke-Copilot-Git-Suggestion { 41 [Alias('?g')] 42 param([string] $query) 43 gh copilot suggest -t git $query 44} 45 46function Invoke-Copilot-GitHub-Cli-Suggestion { 47 [Alias('?gh')] 48 param([string] $query) 49 gh copilot suggest -t gh $query 50} 51 52function Invoke-Copilot-Explain { 53 [Alias('?e')] 54 param([string] $query) 55 gh copilot explain $query 56} 57 58function Send-Key() { 59 [CmdletBinding()] 60 param ( 61 [Parameter( 62 ValueFromPipeline = $true, 63 ValueFromPipelineByPropertyName = $true, 64 Position = 0)] 65 [string] 66 $KeyId = $DEFAULT_PGP_KEYID, 67 68 [Parameter()] 69 [bool] 70 $PublishToOpenPGP = $true, 71 72 [Parameter()] 73 [bool] 74 $PublishToKeybase = $true 75 ) 76 77 Write-Host "Publishing PGP key $KeyId to keyservers" 78 79 Write-Host "Publishing to default keyserver" 80 & gpg --send-key "$KeyId" 81 Write-Host "Publishing to MIT keyserver" 82 & gpg --keyserver pgp.mit.edu --send-key "$KeyId" 83 Write-Host "Publishing to GnuPG keyserver" 84 & gpg --keyserver keys.gnupg.net --send-key "$KeyId" 85 Write-Host "Publishing to Ubuntu keyserver" 86 & gpg --keyserver hkps://keyserver.ubuntu.com:443 --send-key "$KeyId" 87 88 if ($KeyId -eq $DEFAULT_PGP_KEYID) { 89 if ($PublishToOpenPGP) { 90 Write-Host "Publishing key to keys.openpgp.org, this will require verification!" 91 gpg --export $KeyId | curl -T - https://keys.openpgp.org 92 } 93 94 $hasKeybase = Get-Command 'keybase' -ErrorAction SilentlyContinue 95 if ($PublishToKeybase -And $hasKeybase) { 96 Write-Host "Publishing key to Keybase" 97 $fp = $(& gpg --with-colons --fingerprint "$KeyId") | 98 Where-Object { $_ -match 'fpr' } | 99 ForEach-Object { ($_ -split ':')[9] } | 100 Select-Object -First 1 101 Write-Host "Publishing fingerprint $fp to Keybase" 102 & keybase pgp update "$fp" 103 } 104 } 105 106 Write-Host "Publishing of PGP key $KeyId completed!" 107}