Skip to content

Feature Request :: Maintain directory index  #30

@bradphelan

Description

@bradphelan

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
    }

2019-02-28_09-21-26

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions