[feature] add fzf

This commit is contained in:
Klesh Wong 2021-01-14 12:56:57 +08:00
parent c7a50e65bf
commit 121072c540
2 changed files with 27 additions and 3 deletions

View File

@ -1,6 +1,10 @@
# Install-Module -Name PowerShellGet -Force -AllowPrerelease
# Install-Module -Name posh-git
# Install-Module -Name oh-my-posh
# curl: https://curl.se/windows/
# ag: https://github.com/k-takata/the_silver_searcher-win32/releases
# fzf: https://github.com/junegunn/fzf/releases/latest
Install-Module -Name PowerShellGet -Force -AllowPrerelease
Install-Module -Name posh-git
Install-Module -Name oh-my-posh
Install-Module -Name psfzf
$dotfiles=(Get-Item $PSScriptRoot).Parent.FullName
New-Item -ItemType SymbolicLink -Target $dotfiles\win\profile.ps1 -Path $profile -Force

View File

@ -5,6 +5,8 @@
Set-PSReadLineOption -EditMode Emacs
Set-PSReadLineOption -PredictionSource History
Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+t' -PSReadlineChordReverseHistory 'Ctrl+r'
$Env:Path += ";$PSScriptRoot\bin"
$Env:KUBE_EDITOR = 'nvim'
@ -80,3 +82,21 @@ function ssh-copy-id {
Get-Content $IdentityFile | ssh $UserHost "umask 077; mkdir -p .ssh ; cat >> .ssh/authorized_keys"
}
function pass-edit {
param (
[Parameter()]
[String]
$Path
)
$tmpfile = New-TemporaryFile
gpg --decrypt $Path > $tmpfile.FullName
nvim $tmpfile.FullName
if ($? && ((gpg --list-secret-keys | findstr uid) -match '<(.*?)>')) {
$uid=$matches[1]
gpg -r $uid -o "${tmpfile.FullName}.gpg" --encrypt $tmpfile.FullName
Move-Item -Path "${tmpfile.FullName}.gpg" -Destination "$Path" -Force
Remove-Item $tmpfile.FullName -Force
}
}