-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Currently I have the below setup. My folder heirachy is about 200k files and the suggested solution has a 10 to 15 second response time. To make hs respond immediately I have a cache of the directory contents which I can rebuild with ctrl-alt-s.
It's not the ideal solution. What would be nice is a companion tool that keeps the cache up to date by monitoring the file system. Not sure if this is possible in a general way. Just though I'd throw this out to you. Great tool by the way. Even with rebuilding the cache manually it's awesome.
# Trigger fuzzy search
Set-PSReadlineKeyHandler `
-Chord 'Ctrl+s' `
-BriefDescription "InsertHeatseekerPathInCommandLine" `
-LongDescription "Run Heatseeker in the PWD, appending any selected paths to the current command" `
-ScriptBlock {
$choices = [IO.File]::ReadAllText($(Resolve-Path .hscache)) | hs
$ps::Insert($choices -join " ")
}
# Rebuild cache
Set-PSReadlineKeyHandler `
-Chord 'Ctrl+Alt+s' `
-BriefDescription "RebuildHeatseekerPathInCommandLineCache" `
-LongDescription "Rebuilds the heatseaker cache" `
-ScriptBlock {
$job = start-job {
param($path)
Get-ChildItem -Name -Attributes !D -Recurse $path > $path/.hscache
} -arg $(pwd)
while( $job.State -ne "Completed") {
Write-Progress -Activity ".hscache-build " -Status $(get-childitem .hscache).length
sleep -m 200
}
Write-Progress -Activity ".hscache-build" -Completed
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
