From dcaf205f6e57577e9572c49da21d271c81fa2826 Mon Sep 17 00:00:00 2001 From: Michael Kelley Date: Sat, 20 Jan 2024 21:52:27 -0800 Subject: [PATCH] Remove -NoSort from history commands (#244) - Also add CTRL-Z for history - Resolves #240 --- PSFzf.Base.ps1 | 4 ++-- PSFzf.Functions.ps1 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/PSFzf.Base.ps1 b/PSFzf.Base.ps1 index 2d5fa09..ab9ed6f 100644 --- a/PSFzf.Base.ps1 +++ b/PSFzf.Base.ps1 @@ -791,7 +791,7 @@ function Invoke-FzfPsReadlineHandlerHistory { $fileHist.Add($_,$true) $_ } - } | Invoke-Fzf -Query "$line" -NoSort -Bind ctrl-r:toggle-sort -Scheme history | ForEach-Object { $result = $_ } + } | Invoke-Fzf -Query "$line" -Bind ctrl-r:toggle-sort, ctrl-z:ignore -Scheme history | ForEach-Object { $result = $_ } } catch { @@ -836,7 +836,7 @@ function Invoke-FzfPsReadlineHandlerHistoryArgs { } | Where-Object {$_.type -eq "commandargument" -or $_.type -eq "string"} | ForEach-Object { if (!$contentTable.ContainsKey($_.Content)) { $_.Content ; $contentTable[$_.Content] = $true } - } | Invoke-Fzf -NoSort -Multi | ForEach-Object { $result += $_ } + } | Invoke-Fzf -Multi | ForEach-Object { $result += $_ } } catch { diff --git a/PSFzf.Functions.ps1 b/PSFzf.Functions.ps1 index bd4d333..acfc61d 100644 --- a/PSFzf.Functions.ps1 +++ b/PSFzf.Functions.ps1 @@ -161,10 +161,10 @@ function Invoke-FuzzyFasd() { #.ExternalHelp PSFzf.psm1-help.xml function Invoke-FuzzyHistory() { if (Get-Command Get-PSReadLineOption -ErrorAction Ignore) { - $result = Get-Content (Get-PSReadLineOption).HistorySavePath | Invoke-Fzf -Reverse -NoSort -Scheme history + $result = Get-Content (Get-PSReadLineOption).HistorySavePath | Invoke-Fzf -Reverse -Scheme history } else { - $result = Get-History | ForEach-Object { $_.CommandLine } | Invoke-Fzf -Reverse -NoSort -Scheme history + $result = Get-History | ForEach-Object { $_.CommandLine } | Invoke-Fzf -Reverse -Scheme history } if ($null -ne $result) { Write-Output "Invoking '$result'`n"