|
|
@@ -9,6 +9,12 @@ return {
|
|
|
},
|
|
|
config = function(_, _)
|
|
|
local builtin = require("telescope.builtin")
|
|
|
+ local actions = require("telescope.actions")
|
|
|
+ local conf = require("telescope.config").values
|
|
|
+ local finders = require("telescope.finders")
|
|
|
+ local pickers = require("telescope.pickers")
|
|
|
+ local themes = require("telescope.themes")
|
|
|
+ local action_state = require("telescope.actions.state")
|
|
|
require("telescope").setup({
|
|
|
extensions = {
|
|
|
["ui-select"] = { require("telescope.themes").get_dropdown() }
|
|
|
@@ -29,7 +35,7 @@ return {
|
|
|
},
|
|
|
pickers = {
|
|
|
live_grep = {
|
|
|
- additional_args = function(opts)
|
|
|
+ additional_args = function(_)
|
|
|
return { "--hidden", "--glob=!**/.git/*" }
|
|
|
end
|
|
|
}
|
|
|
@@ -50,6 +56,49 @@ return {
|
|
|
vim.keymap.set("n", "sa", builtin.find_files)
|
|
|
vim.keymap.set("n", "sg", builtin.git_files)
|
|
|
vim.keymap.set("n", "si", builtin.live_grep)
|
|
|
+ vim.keymap.set("n", "sI", function()
|
|
|
+ local async = require 'plenary.async'
|
|
|
+ local sender, receiver = async.control.channel.mpsc()
|
|
|
+ local results = {}
|
|
|
+ async.run(function()
|
|
|
+ local result = vim.fn.system(
|
|
|
+ "fd -t f | rev | cut -d/ -f1 -s | cut -d. -f1 -s | rev | tr '[:upper:]' '[:lower:]' | sort | uniq | xargs -I{} -n 1 printf '*.{}\n!*.{}\n'")
|
|
|
+ sender.send(result)
|
|
|
+ end)
|
|
|
+ async.run(function()
|
|
|
+ local result = vim.fn.system(
|
|
|
+ "fd -t d | xargs -n 1 -I{} printf '{}*\n!{}*\n'")
|
|
|
+ sender.send(result)
|
|
|
+ end)
|
|
|
+ async.run(function()
|
|
|
+ local result = vim.fn.system(
|
|
|
+ "fd -t d | rev | cut -d/ -f2 -s | rev | sort | uniq | xargs -n 1 -I{} printf '**/{}/*\n!**/{}/*\n'")
|
|
|
+ sender.send(result)
|
|
|
+ end)
|
|
|
+ for _ = 1, 3 do
|
|
|
+ local value = receiver.recv()
|
|
|
+ if value ~= nil then
|
|
|
+ results = vim.list_extend(results,
|
|
|
+ vim.split(value, "\n"))
|
|
|
+ end
|
|
|
+ end
|
|
|
+ pickers.new(themes.get_dropdown({}),
|
|
|
+ {
|
|
|
+ finder = finders.new_table({
|
|
|
+ results = results
|
|
|
+ }),
|
|
|
+ sorter = conf.generic_sorter(),
|
|
|
+ attach_mappings = function(prompt_bufnr, _)
|
|
|
+ actions.select_default:replace(function()
|
|
|
+ actions.close(prompt_bufnr)
|
|
|
+ local selection = action_state
|
|
|
+ .get_selected_entry()
|
|
|
+ builtin.live_grep({ glob_pattern = selection })
|
|
|
+ end)
|
|
|
+ return true
|
|
|
+ end,
|
|
|
+ }):find()
|
|
|
+ end)
|
|
|
vim.keymap.set("n", "sb", builtin.buffers)
|
|
|
vim.keymap.set("n", "sj", builtin.jumplist)
|
|
|
vim.keymap.set("n", "sw", builtin.grep_string)
|