From 494ff3e6a08a2b17ca9f3de78c583da465c87851 Mon Sep 17 00:00:00 2001 From: Brian Zalewski Date: Tue, 25 Oct 2022 04:34:56 +0000 Subject: [PATCH] Update dotfiles/.config/powershell/user_profile.ps1 --- dotfiles/.config/powershell/user_profile.ps1 | 24 +++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/dotfiles/.config/powershell/user_profile.ps1 b/dotfiles/.config/powershell/user_profile.ps1 index 09333da3..bb241d11 100644 --- a/dotfiles/.config/powershell/user_profile.ps1 +++ b/dotfiles/.config/powershell/user_profile.ps1 @@ -1,14 +1,21 @@ # set PowerShell to UTF-8 [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding +Install-Module posh-git -Scope CurrentUser +Install-Module oh-my-posh -Scope CurrentUser +Install-Module -Name PSReadLine -AllowPrerelease -Scope CurrentUser -Force -SkipPublisherCheck +Set-Prompt + Import-Module posh-git +Import-Module oh-my-posh $omp_config = Join-Path $PSScriptRoot ".\takuya.omp.json" oh-my-posh --init --shell pwsh --config $omp_config | Invoke-Expression +Set-Theme Paradox Import-Module -Name Terminal-Icons # PSReadLine -Set-PSReadLineOption -EditMode Emacs +Set-PSReadLineOption -EditMode Vim Set-PSReadLineOption -BellStyle None Set-PSReadLineKeyHandler -Chord 'Ctrl+d' -Function DeleteChar Set-PSReadLineOption -PredictionSource History @@ -17,18 +24,19 @@ Set-PSReadLineOption -PredictionSource History Import-Module PSFzf Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+f' -PSReadlineChordReverseHistory 'Ctrl+r' +### zoxide +Invoke-Expression (& { + $hook = if ($PSVersionTable.PSVersion.Major -lt 6) { 'prompt' } else { 'pwd' } + (zoxide init --hook $hook powershell | Out-String) +}) + # Env $env:GIT_SSH = "C:\Windows\system32\OpenSSH\ssh.exe" -# Alias -Set-Alias -Name vim -Value nvim -Set-Alias ll ls -Set-Alias g git +### Aliases Set-Alias grep findstr -Set-Alias tig 'C:\Program Files\Git\usr\bin\tig.exe' -Set-Alias less 'C:\Program Files\Git\usr\bin\less.exe' -# Utilities +### Utilities function which ($command) { Get-Command -Name $command -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Path -ErrorAction SilentlyContinue