Closed cstsunfu closed 2 days ago
Almost the same idea is issued on #125. I'm thinking an idea that I will introduce a “query” function to get entries from the DB.
local files = require("frecency").query {
limit = 100,
order_by = "score",
}
and this contains such as……
[
"/path/to/foo.txt",
"/more/path/to/bar.md",
……
-- up to 100 files
]
Then your code can be shorten like this.
local frecency_file_path = require("frecency").query { …… }
local live_grepper = finders.new_job(function(prompt)
if not prompt or prompt == "" then
return nil
end
return vim.tbl_flatten({ args, "--", prompt, frecency_file_path })
end, make_entry.gen_from_vimgrep({}), 1000, "/")
pickers.new(……):find()
I see some people want to output entries from DB to use outside this plugin (#157), so this function can also be a solution for it.
How do you think this? Can this satisfy your purpose?
Almost the same idea is issued on #125. I'm thinking an idea that I will introduce a “query” function to get entries from the DB.
local files = require("frecency").query { limit = 100, order_by = "score", }
and this contains such as……
[ "/path/to/foo.txt", "/more/path/to/bar.md", …… -- up to 100 files ]
Then your code can be shorten like this.
local frecency_file_path = require("frecency").query { …… } local live_grepper = finders.new_job(function(prompt) if not prompt or prompt == "" then return nil end return vim.tbl_flatten({ args, "--", prompt, frecency_file_path }) end, make_entry.gen_from_vimgrep({}), 1000, "/") pickers.new(……):find()
I see some people want to output entries from DB to use outside this plugin (#157), so this function can also be a solution for it.
How do you think this? Can this satisfy your purpose?
Yes, I think this is a great solution. This is very helpful for my issue, and this will used on many other purpose.
I am still implementing #217 experimentally, but I can see it achieves your purpose with simple code.
(And I also found telescope's builtin live_grep picker accepts filenames to search.)
vim.keymap.set("n", "<Leader>tg", function()
local frecency = require("telescope").extensions.frecency
require("telescope.builtin").live_grep {
-- HACK: `search_dirs` can accept files to grep nevertheless its name
search_dirs = frecency.query {},
}
end)
I added query()
to get entries from DB. Check it.
It works. Thanks for your awesome job.
Thanks for the good job. I have used this plugin long time and this is a pretty good plugin to find the recent files.
But sometimes I am not remember the file name but a string in the content. It is better for me to search the content in the recent files. I am not good at telescope, so I only write a ugly code to make it work at git commit 'a3e818d0', but when the plugin is update it does not work anymore. So could you provide this as a builtin feature? Thanks