From d5103f03675124a6d7e5853da0bb0d8d6b4db047 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Thu, 29 Sep 2022 19:14:50 +0900 Subject: [PATCH] add: pwsh :improve comments & add scoop completion --- dotfiles/pwsh/powershell_profile.ps1 | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/dotfiles/pwsh/powershell_profile.ps1 b/dotfiles/pwsh/powershell_profile.ps1 index efdd151..d098d57 100644 --- a/dotfiles/pwsh/powershell_profile.ps1 +++ b/dotfiles/pwsh/powershell_profile.ps1 @@ -1,4 +1,6 @@ -# auto completion +# ============================================================== +# PSReadLine Settings +# ============================================================== Import-Module PSReadLine Set-PSReadLineOption -PredictionSource History Set-PSReadlineOption -HistoryNoDuplicates @@ -11,13 +13,16 @@ Set-PSReadLineKeyHandler -Chord "Ctrl+g" -ScriptBlock { Invoke-FzfTabCompletion # 'Ctrl+t' for provider path, 'Ctrl+r' for reverse history Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+t' -PSReadlineChordReverseHistory 'Ctrl+r' + +# ============================================================== +# alias and functions +# ============================================================== function ~ { cd ~ } function .. { cd .. } function epl {explorer.exe .} Set-Alias touch New-Item Set-Alias whereis where.exe - # starship # change window name function Invoke-Starship-PreCommand { @@ -33,7 +38,11 @@ function home_util { & (Join-Path -Path $home_util_path -ChildPath "home_util.exe") } -# change encoding + + +# -------------------------------------------------------------- +# change encoding +# -------------------------------------------------------------- # ref: https://qiita.com/e4rfx/items/3772ecb58b6918ed5348 # 文字エンコードをUTF8に設定する function Set-UTF8 { @@ -125,6 +134,15 @@ $env:LESS = "-i -M -R -S -W -z-4 -x4" +# ============================================================== +# auto completions for modules +# ============================================================== + +# scoop +# enable completion in current shell, use absolute path because PowerShell Core not respect $env:PSModulePath +Import-Module scoop-completion +#Import-Module "$($(Get-Item $(Get-Command scoop.ps1).Path).Directory.Parent.FullName)\modules\scoop-completion" + # chezmoi completion $script = "$HOME\.config\powershell\chezmoi_completion.ps1" if (Test-Path $script) {