Go to file
Senghan Bright 6dd33341e7 fixes
2021-01-15 12:16:18 +01:00
lua/telescope/_extensions fixes 2021-01-15 12:16:18 +01:00
LICENSE Inital commit. 2021-01-14 01:37:37 +01:00
README.md update readme 2021-01-14 21:07:51 +01:00

telescope-frecency.nvim

An implementation of Mozilla's Frecency algorithm for telescope.nvim.

Frecency: sorting by "frequency" and "recency"

Frecency is a score given to each unique file loaded into a Neovim buffer.

A timestamp is recorded to a database on each file load.

The score is calculated using the age of the 10 most recent timestamps and the total amount of times the file has been loaded:

Recency values (per timestamp)

Timestamp age Value
4 hours 100
1 day 80
3 days 60
1 week 40
1 month 20
90 days 10

Score calculation

score = frequency * recency_score / max_number_of_timestamps

WIP

TODO:

  • Implement sorter based on frecency score
  • Improve substring matcher to support multiple terms
  • Check file entries are valid via async job on VimClose
screenshot
  • Scores shown in finder for illustration purposes only

Requirements

Timestamps and file records are stored in an SQLite3 database for persistence and speed. This plugin uses sql.nvim to perform the database transactions.

Installation

TODO: add installation instructions for other package managers

use {
  "sunjon/telescope-frecency",
  config = function()
    require"telescope".load_extension("frecency")
  end
}

Configuration

Function for keymaps

lua require("telescope").extensions.frecency.frecency(opts)
:Telescope frecency

References