Skip to content
rupa edited this page Feb 24, 2016 · 5 revisions

Frecency is the idea of blending frequency (the amount of time you spend in a directory) with recentness (how recently you were in a directory).

Currently, the algorithm is as follows:

rank is the number of times you’ve got a PROMPT in a directory.

if a directory was accessed less than an hour ago, rank is multiplied by 4
if a directory was accessed less than a day ago, rank is multiplied by 2
if a directory was accessed less than a week ago, rank is divided by 2
if a directory was accessed more than a week ago, rank is divided by 4

the code:


t=$(date +%s) # timestamp
function frecent(rank, time) {
    dx = t-time
    if( dx < 3600 ) return rank*4
    if( dx < 86400 ) return rank*2
    if( dx < 604800 ) return rank/2
    return rank/4
}

z -l compared to z -r -l will show the difference between frecent and rank only.

These values work well for me so far, but were basically pulled out of a hat. Input or tweaks would be well appreciated. It would be great if it could be a continuous function.

Clone this wiki locally