add: pwsh :improve comments & add scoop completion

This commit is contained in:
qwjyh 2022-09-29 19:14:50 +09:00
parent bd055f6240
commit d5103f0367

View file

@ -1,4 +1,6 @@
# auto completion # ==============================================================
# PSReadLine Settings
# ==============================================================
Import-Module PSReadLine Import-Module PSReadLine
Set-PSReadLineOption -PredictionSource History Set-PSReadLineOption -PredictionSource History
Set-PSReadlineOption -HistoryNoDuplicates 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 # 'Ctrl+t' for provider path, 'Ctrl+r' for reverse history
Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+t' -PSReadlineChordReverseHistory 'Ctrl+r' Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+t' -PSReadlineChordReverseHistory 'Ctrl+r'
# ==============================================================
# alias and functions
# ==============================================================
function ~ { cd ~ } function ~ { cd ~ }
function .. { cd .. } function .. { cd .. }
function epl {explorer.exe .} function epl {explorer.exe .}
Set-Alias touch New-Item Set-Alias touch New-Item
Set-Alias whereis where.exe Set-Alias whereis where.exe
# starship # starship
# change window name # change window name
function Invoke-Starship-PreCommand { function Invoke-Starship-PreCommand {
@ -33,7 +38,11 @@ function home_util {
& (Join-Path -Path $home_util_path -ChildPath "home_util.exe") & (Join-Path -Path $home_util_path -ChildPath "home_util.exe")
} }
# change encoding
# --------------------------------------------------------------
# change encoding
# --------------------------------------------------------------
# ref: https://qiita.com/e4rfx/items/3772ecb58b6918ed5348 # ref: https://qiita.com/e4rfx/items/3772ecb58b6918ed5348
# 文字エンコードをUTF8に設定する # 文字エンコードをUTF8に設定する
function Set-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 # chezmoi completion
$script = "$HOME\.config\powershell\chezmoi_completion.ps1" $script = "$HOME\.config\powershell\chezmoi_completion.ps1"
if (Test-Path $script) { if (Test-Path $script) {