Skip to content

Commit

Permalink
Remove -NoSort from history commands (#244)
Browse files Browse the repository at this point in the history
- Also add CTRL-Z for history
- Resolves #240
  • Loading branch information
kelleyma49 authored Jan 21, 2024
1 parent b5bc50e commit dcaf205
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions PSFzf.Base.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down
4 changes: 2 additions & 2 deletions PSFzf.Functions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit dcaf205

Please sign in to comment.