2022-10-24 14:38:08 -07:00
|
|
|
# set PowerShell to UTF-8
|
|
|
|
[console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
|
|
|
|
|
2022-10-24 21:34:56 -07:00
|
|
|
Install-Module posh-git -Scope CurrentUser
|
|
|
|
Install-Module oh-my-posh -Scope CurrentUser
|
|
|
|
Install-Module -Name PSReadLine -AllowPrerelease -Scope CurrentUser -Force -SkipPublisherCheck
|
|
|
|
Set-Prompt
|
|
|
|
|
2022-10-24 14:38:08 -07:00
|
|
|
Import-Module posh-git
|
2022-10-24 21:34:56 -07:00
|
|
|
Import-Module oh-my-posh
|
2022-10-24 14:38:08 -07:00
|
|
|
$omp_config = Join-Path $PSScriptRoot ".\takuya.omp.json"
|
|
|
|
oh-my-posh --init --shell pwsh --config $omp_config | Invoke-Expression
|
2022-10-24 21:34:56 -07:00
|
|
|
Set-Theme Paradox
|
2022-10-24 14:38:08 -07:00
|
|
|
|
|
|
|
Import-Module -Name Terminal-Icons
|
|
|
|
|
|
|
|
# PSReadLine
|
2022-10-24 21:34:56 -07:00
|
|
|
Set-PSReadLineOption -EditMode Vim
|
2022-10-24 14:38:08 -07:00
|
|
|
Set-PSReadLineOption -BellStyle None
|
|
|
|
Set-PSReadLineKeyHandler -Chord 'Ctrl+d' -Function DeleteChar
|
|
|
|
Set-PSReadLineOption -PredictionSource History
|
|
|
|
|
|
|
|
# Fzf
|
|
|
|
Import-Module PSFzf
|
|
|
|
Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+f' -PSReadlineChordReverseHistory 'Ctrl+r'
|
|
|
|
|
2022-10-24 21:34:56 -07:00
|
|
|
### zoxide
|
|
|
|
Invoke-Expression (& {
|
|
|
|
$hook = if ($PSVersionTable.PSVersion.Major -lt 6) { 'prompt' } else { 'pwd' }
|
|
|
|
(zoxide init --hook $hook powershell | Out-String)
|
|
|
|
})
|
|
|
|
|
2022-10-24 14:38:08 -07:00
|
|
|
# Env
|
|
|
|
$env:GIT_SSH = "C:\Windows\system32\OpenSSH\ssh.exe"
|
|
|
|
|
2022-10-24 21:34:56 -07:00
|
|
|
### Aliases
|
2022-10-24 14:38:08 -07:00
|
|
|
Set-Alias grep findstr
|
|
|
|
|
2022-10-24 21:34:56 -07:00
|
|
|
### Utilities
|
2022-10-24 14:38:08 -07:00
|
|
|
function which ($command) {
|
|
|
|
Get-Command -Name $command -ErrorAction SilentlyContinue |
|
|
|
|
Select-Object -ExpandProperty Path -ErrorAction SilentlyContinue
|
|
|
|
}
|