diff --git a/README.md b/README.md index 59fe518..a018820 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ As the extension learns your editing habits over time, the sorting of the list i A timestamp is recorded once per session when a file is first loaded into a buffer. -The score is calculated using the age of the 10 most recent timestamps and the total amount of times that the file has been loaded: +The score is calculated using the age of the 10 (customizable) most recent timestamps and the total amount of times that the file has been loaded: ### Recency values (per timestamp) @@ -135,27 +135,19 @@ See [default configuration](https://github.com/nvim-telescope/telescope.nvim#tel Default workspace tag to filter by e.g. `'CWD'` to filter by default to the current directory. Can be overridden at query time by specifying another filter like `':*:'`. +- `disable_devicons` (default: `false`) + + Disable devicons (if available) + - `ignore_patterns` (default: `{ "*.git/*", "*/tmp/*", "term://*" }`) Patterns in this table control which files are indexed (and subsequently which you'll see in the finder results). -- `show_scores` (default : `false`) +- `max_timestamps` (default: `10`) - To see the scores generated by the algorithm in the results, set this to `true`. + Set the max count of timestamps DB keeps when you open files. It ignores the value and use `10` if you set less than or equal to `0`. -- `workspaces` (default: `{}`) - - This table contains mappings of `workspace_tag` -> `workspace_directory` - The key corresponds to the `:tag_name` used to select the filter in queries. - The value corresponds to the top level directory by which results will be filtered. - -- `show_unindexed` (default: `true`) - - Determines if non-indexed files are included in workspace filter results. - -- `disable_devicons` (default: `false`) - - Disable devicons (if available) + **CAUTION** When you reduce the value of this option, it removes old timestamps when you open the file. It is reasonable to set this value more than or equal to the default value: `10`. - `show_filter_column` (default: `true`) @@ -166,10 +158,24 @@ See [default configuration](https://github.com/nvim-telescope/telescope.nvim#tel show_filter_column = { "LSP", "CWD", "FOO" } ``` +- `show_scores` (default : `false`) + + To see the scores generated by the algorithm in the results, set this to `true`. + +- `show_unindexed` (default: `true`) + + Determines if non-indexed files are included in workspace filter results. + - `use_sqlite` (default: `true`) ***experimental feature*** Use [sqlite.lua] `true` or native code `false`. See [*Remove dependency for sqlite.lua*](#user-content-remove-dependency-for-sqlitelua) for the detail. +- `workspaces` (default: `{}`) + + This table contains mappings of `workspace_tag` -> `workspace_directory` + The key corresponds to the `:tag_name` used to select the filter in queries. + The value corresponds to the top level directory by which results will be filtered. + ### Example Configuration: ```lua diff --git a/lua/frecency/frecency.lua b/lua/frecency/frecency.lua index 7374707..981f0d1 100644 --- a/lua/frecency/frecency.lua +++ b/lua/frecency/frecency.lua @@ -29,6 +29,7 @@ local Frecency = {} ---@field disable_devicons boolean? default: false ---@field filter_delimiter string? default: ":" ---@field ignore_patterns string[]? default: { "*.git/*", "*/tmp/*", "term://*" } +---@field max_timestamps integer? default: 10 ---@field show_filter_column boolean|string[]|nil default: true ---@field show_scores boolean? default: false ---@field show_unindexed boolean? default: true @@ -48,6 +49,7 @@ Frecency.new = function(opts) disable_devicons = false, filter_delimiter = ":", ignore_patterns = { "*.git/*", "*/tmp/*", "term://*" }, + max_timestamps = 10, show_filter_column = true, show_scores = false, show_unindexed = true, @@ -72,7 +74,8 @@ Frecency.new = function(opts) show_filter_column = config.show_filter_column, show_scores = config.show_scores, }) - self.recency = Recency.new() + local max_count = config.max_timestamps > 0 and config.max_timestamps or 10 + self.recency = Recency.new { max_count = max_count } self.migrator = Migrator.new(self.fs, self.recency, self.config.db_root) return self end