feat: add an option for a function to ignore files (#223)

* refactor: use vim.pesc instead of implementing

* feat: add optional func to ignore in registering

* test: add tests for ignore_register function

* docs: add note for `ignore_register` option

* docs: add note for use case of `ignore_patterns`
This commit is contained in:
JINNOUCHI Yasushi
2024-07-14 23:11:14 +09:00
committed by GitHub
parent 03d43510d0
commit be5add7248
6 changed files with 61 additions and 6 deletions

View File

@@ -443,9 +443,31 @@ Default:
for Windows: `{ [[*.git\*]], [[*\tmp\*]], "term://*" }`
Type: `string`
Patterns in this table control which files are indexed (and subsequently which
you'll see in the finder results).
Glob patterns in this table control which files are indexed (and subsequently
which you'll see in the finder results).
*telescope-frecency-configuration-ignore_register*
ignore_register ~
Default: `nil`
Type: `fun(bufnr: integer): boolean`
In opening buffers, it registers the filename and timestamps into DB to
calculate frecency scores later. `ignore_register` can take a buffer number
and you can control whether the file should be registered or not.
For example, you can ignore |'nobuflisted'| buffers to register with this below.
>lua
telescope.setup {
extensions = {
frecency = {
ignore_register = function(bufnr)
return not vim.bo[bufnr].buflisted
end,
}
},
}
<
*telescope-frecency-configuration-matcher*
matcher ~
@@ -592,6 +614,11 @@ workspace files. It tries in order until it works successfully.
If you like another commands, set them to this option, like
`workspace_scan_cmd = { "find", ".", "-type", "f" }`.
NOTE: When the plugin uses “4. Native Lua code”, it uses
|telescope-frecency-configuration-ignore_patterns| to ignore candidates from
listed entries. With other ways, such as `rg` and `fd`, it does not use the option
because of performance consideration.
*telescope-frecency-configuration-workspaces*
workspaces ~