mirror of
https://github.com/kristoferssolo/telescope-frecency.nvim.git
synced 2025-10-21 20:10:38 +00:00
parent
237ece9bfb
commit
ffa2027102
@ -169,26 +169,26 @@ local frecency = function(opts)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local delim = opts.filter_delimiter or ":"
|
||||||
|
local filter_re = "^(" .. delim .. "(%S+)" .. delim .. ")"
|
||||||
|
|
||||||
state.picker = pickers.new(opts, {
|
state.picker = pickers.new(opts, {
|
||||||
prompt_title = "Frecency",
|
prompt_title = "Frecency",
|
||||||
on_input_filter_cb = function(query_text)
|
on_input_filter_cb = function(query_text)
|
||||||
local delim = opts.filter_delimiter or ":"
|
|
||||||
-- check for :filter: in query text
|
-- check for :filter: in query text
|
||||||
local new_filter = query_text:gmatch(delim .. "%S+" .. delim)()
|
local matched, new_filter = query_text:match(filter_re)
|
||||||
|
if matched then
|
||||||
if new_filter then
|
query_text = query_text:sub(matched:len() + 1)
|
||||||
query_text = query_text:gsub(new_filter, "")
|
|
||||||
new_filter = new_filter:gsub(delim, "")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local new_finder
|
local new_finder
|
||||||
local results_updated = update_results(new_filter)
|
local results_updated = update_results(new_filter)
|
||||||
if results_updated then
|
if results_updated then
|
||||||
displayer = entry_display.create {
|
displayer = entry_display.create {
|
||||||
separator = "",
|
separator = "",
|
||||||
hl_chars = {[os_path_sep] = "TelescopePathSeparator"},
|
hl_chars = {[os_path_sep] = "TelescopePathSeparator"},
|
||||||
items = get_display_cols()
|
items = get_display_cols()
|
||||||
}
|
}
|
||||||
|
|
||||||
state.last_filter = new_filter
|
state.last_filter = new_filter
|
||||||
new_finder = finders.new_table {
|
new_finder = finders.new_table {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user