From 1189184484e3153533af66b219f9ed59263a403c Mon Sep 17 00:00:00 2001 From: JINNOUCHI Yasushi Date: Mon, 22 Jan 2024 22:34:02 +0900 Subject: [PATCH] fix!: no confirm always when `db_safe_mode` is off (#162) * fix!: no confirm always when `db_safe_mode` is off Fix: #50 Fix: #167 Before this, `db_safe_mode = false` makes it no confirmation in `:FrecencyValidate!`, but it still does in `:FrecencyValidate` and the auto validation in Neovim's startup. After this commit, `db_safe_mode = false` makes it no confirmation always when you see. And `force` option in `Frecency:validate_database(force)` now means weather it should remove files less than threshold. * docs: add notes for lacked options --- README.md | 18 ++++++++++++++++++ lua/frecency/frecency.lua | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6207d64..71f3a0e 100644 --- a/README.md +++ b/README.md @@ -155,11 +155,25 @@ available tags. See [default configuration](https://github.com/nvim-telescope/telescope.nvim#telescope-defaults) for full details on configuring Telescope. +- `auto_validate` (default: `true`) + + If `true`, it removes stale entries count over than `db_validate_threshold`. See + the note for [DB maintenance](#maintainance) + - `db_root` (default: `vim.fn.stdpath "data"`) Path to parent directory of custom database location. Defaults to `$XDG_DATA_HOME/nvim` if unset. +- `db_safe_mode` (default: `true`) + + If `true`, it shows confirmation dialog by `vim.ui.select()` before validating + DB. See the note for [DB maintenance](#maintainance). + +- `db_validate_threshold` (default: `10`) + + It will removes over than this count in validating DB. + - `default_workspace` (default: `nil`) Default workspace tag to filter by e.g. `'CWD'` to filter by default to the @@ -170,6 +184,10 @@ See [default configuration](https://github.com/nvim-telescope/telescope.nvim#tel Disable devicons (if available) +- `filter_delimiter` (default: `":"`) + + Delimiters to indicate the filter like `:CWD:`. + - `ignore_patterns` (default: `{ "*.git/*", "*/tmp/*", "term://*" }`) Patterns in this table control which files are indexed (and subsequently diff --git a/lua/frecency/frecency.lua b/lua/frecency/frecency.lua index 30abd94..ce7db73 100644 --- a/lua/frecency/frecency.lua +++ b/lua/frecency/frecency.lua @@ -180,7 +180,7 @@ function Frecency:validate_database(force) self.database:remove_files(unlinked) self:notify("removed %d missing entries.", #unlinked) end - if force and not self.config.db_safe_mode then + if not self.config.db_safe_mode then remove_entries() return end