feat: Closes #205
This commit is contained in:
11
README.md
11
README.md
@@ -89,6 +89,17 @@ require('telescope').setup{
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Default Configuration Keys
|
||||||
|
|
||||||
|
|
||||||
|
- ( Missing configuration description for many items here, but I'm trying :smile: )
|
||||||
|
- `file_ignore_patterns`:
|
||||||
|
- List of strings that are Lua patterns that, if any are matched, will make result be ignored.
|
||||||
|
- Please note, these are Lua patterns. See: [Lua Patterns](https://www.lua.org/pil/20.2.html)
|
||||||
|
- Example:
|
||||||
|
- `file_ignore_patterns = { "scratch/.*", "%.env" }`
|
||||||
|
- This will ignore anything in `scratch/` folders and any files named `.env`
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ function config.set_defaults(defaults)
|
|||||||
|
|
||||||
set("generic_sorter", sorters.get_generic_fuzzy_sorter)
|
set("generic_sorter", sorters.get_generic_fuzzy_sorter)
|
||||||
set("file_sorter", sorters.get_fuzzy_file)
|
set("file_sorter", sorters.get_fuzzy_file)
|
||||||
|
|
||||||
|
set("file_ignore_patterns", nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
function config.clear_defaults()
|
function config.clear_defaults()
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ function Picker:new(opts)
|
|||||||
stats = {},
|
stats = {},
|
||||||
|
|
||||||
attach_mappings = opts.attach_mappings,
|
attach_mappings = opts.attach_mappings,
|
||||||
|
file_ignore_patterns = get_default(opts.file_ignore_patterns, config.values.file_ignore_patterns),
|
||||||
|
|
||||||
sorting_strategy = get_default(opts.sorting_strategy, config.values.sorting_strategy),
|
sorting_strategy = get_default(opts.sorting_strategy, config.values.sorting_strategy),
|
||||||
selection_strategy = get_default(opts.selection_strategy, config.values.selection_strategy),
|
selection_strategy = get_default(opts.selection_strategy, config.values.selection_strategy),
|
||||||
@@ -421,6 +422,13 @@ function Picker:find()
|
|||||||
|
|
||||||
log.trace("Processing result... ", entry)
|
log.trace("Processing result... ", entry)
|
||||||
|
|
||||||
|
for _, v in ipairs(self.file_ignore_patterns or {}) do
|
||||||
|
if string.find(entry.value, v) then
|
||||||
|
log.debug("SKPIPING", entry.value, "because", v)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local sort_ok, sort_score = nil, 0
|
local sort_ok, sort_score = nil, 0
|
||||||
if self.sorter then
|
if self.sorter then
|
||||||
sort_ok, sort_score = self:_track("_sort_time", pcall, self.sorter.score, self.sorter, prompt, entry)
|
sort_ok, sort_score = self:_track("_sort_time", pcall, self.sorter.score, self.sorter, prompt, entry)
|
||||||
|
|||||||
Reference in New Issue
Block a user