|
@ -1,11 +1,13 @@ |
|
|
return { |
|
|
return { |
|
|
"nvim-telescope/telescope.nvim", |
|
|
"nvim-telescope/telescope.nvim", |
|
|
|
|
|
cmd = "Telescope", |
|
|
dependencies = { |
|
|
dependencies = { |
|
|
"nvim-lua/plenary.nvim", |
|
|
"nvim-lua/plenary.nvim", |
|
|
"nvim-tree/nvim-web-devicons", |
|
|
"nvim-tree/nvim-web-devicons", |
|
|
"debugloop/telescope-undo.nvim", |
|
|
"debugloop/telescope-undo.nvim", |
|
|
"nvim-telescope/telescope-ui-select.nvim", |
|
|
"nvim-telescope/telescope-ui-select.nvim", |
|
|
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, |
|
|
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, |
|
|
|
|
|
"nvim-telescope/telescope-live-grep-args.nvim", |
|
|
}, |
|
|
}, |
|
|
config = function() |
|
|
config = function() |
|
|
local telescope = require("telescope") |
|
|
local telescope = require("telescope") |
|
@ -64,6 +66,20 @@ return { |
|
|
picker(opts) |
|
|
picker(opts) |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Visual selection live grep |
|
|
|
|
|
local function grep_string_visual() |
|
|
|
|
|
vim.cmd('noau normal! "vy"') |
|
|
|
|
|
local text = vim.fn.getreg('v') |
|
|
|
|
|
vim.fn.setreg('v', {}) |
|
|
|
|
|
|
|
|
|
|
|
text = string.gsub(text, "\n", "") |
|
|
|
|
|
if #text > 0 then |
|
|
|
|
|
builtin.live_grep({ default_text = text }) |
|
|
|
|
|
else |
|
|
|
|
|
builtin.live_grep() |
|
|
|
|
|
end |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
-- Telescope setup |
|
|
-- Telescope setup |
|
|
telescope.setup({ |
|
|
telescope.setup({ |
|
|
defaults = { |
|
|
defaults = { |
|
@ -159,6 +175,18 @@ return { |
|
|
override_file_sorter = true, |
|
|
override_file_sorter = true, |
|
|
case_mode = "smart_case", |
|
|
case_mode = "smart_case", |
|
|
}, |
|
|
}, |
|
|
|
|
|
live_grep_args = { |
|
|
|
|
|
auto_quoting = true, |
|
|
|
|
|
mappings = { |
|
|
|
|
|
i = { |
|
|
|
|
|
["<C-k>"] = require("telescope-live-grep-args.actions").quote_prompt(), |
|
|
|
|
|
["<C-i>"] = require("telescope-live-grep-args.actions").quote_prompt({ postfix = " --iglob " }), |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
["ui-select"] = { |
|
|
|
|
|
require("telescope.themes").get_dropdown(), |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
@ -166,6 +194,7 @@ return { |
|
|
telescope.load_extension("fzf") |
|
|
telescope.load_extension("fzf") |
|
|
telescope.load_extension("undo") |
|
|
telescope.load_extension("undo") |
|
|
telescope.load_extension("ui-select") |
|
|
telescope.load_extension("ui-select") |
|
|
|
|
|
telescope.load_extension("live_grep_args") |
|
|
|
|
|
|
|
|
-- Keymaps |
|
|
-- Keymaps |
|
|
local function map(mode, lhs, rhs, desc) |
|
|
local function map(mode, lhs, rhs, desc) |
|
@ -174,6 +203,10 @@ return { |
|
|
|
|
|
|
|
|
-- File navigation |
|
|
-- File navigation |
|
|
map("n", "<leader>ff", function() |
|
|
map("n", "<leader>ff", function() |
|
|
|
|
|
require("telescope").extensions.live_grep_args.live_grep_args() |
|
|
|
|
|
end, "Live grep with args") |
|
|
|
|
|
|
|
|
|
|
|
map("n", "<leader>fg", function() |
|
|
require("plugins.telescope.multigrep").live_multgrep() |
|
|
require("plugins.telescope.multigrep").live_multgrep() |
|
|
end, "Live multigrep") |
|
|
end, "Live multigrep") |
|
|
|
|
|
|
|
@ -181,17 +214,20 @@ return { |
|
|
map("n", "<leader>fr", builtin.resume, "Resume last telescope") |
|
|
map("n", "<leader>fr", builtin.resume, "Resume last telescope") |
|
|
map("n", "<leader>fb", builtin.buffers, "Find buffers") |
|
|
map("n", "<leader>fb", builtin.buffers, "Find buffers") |
|
|
map("n", "<leader>fo", builtin.oldfiles, "Find recent files") |
|
|
map("n", "<leader>fo", builtin.oldfiles, "Find recent files") |
|
|
|
|
|
map("n", "<leader>fc", builtin.commands, "Find commands") |
|
|
|
|
|
|
|
|
-- Search |
|
|
-- Search |
|
|
map("n", "<leader>gf", function() |
|
|
|
|
|
|
|
|
map("n", "<leader>fw", function() |
|
|
builtin.grep_string({ search = vim.fn.expand("<cword>") }) |
|
|
builtin.grep_string({ search = vim.fn.expand("<cword>") }) |
|
|
end, "Grep word under cursor") |
|
|
end, "Grep word under cursor") |
|
|
|
|
|
|
|
|
map("n", "<leader>gF", function() |
|
|
|
|
|
|
|
|
map("n", "<leader>fW", function() |
|
|
builtin.grep_string({ search = vim.fn.expand("<cWORD>") }) |
|
|
builtin.grep_string({ search = vim.fn.expand("<cWORD>") }) |
|
|
end, "Grep WORD under cursor") |
|
|
end, "Grep WORD under cursor") |
|
|
|
|
|
|
|
|
map("n", "<leader>gD", function() |
|
|
|
|
|
|
|
|
map("v", "<leader>fw", grep_string_visual, "Grep selection") |
|
|
|
|
|
|
|
|
|
|
|
map("n", "<leader>fF", function() |
|
|
builtin.find_files({ search_file = vim.fn.expand("<cword>") }) |
|
|
builtin.find_files({ search_file = vim.fn.expand("<cword>") }) |
|
|
end, "Find file with name under cursor") |
|
|
end, "Find file with name under cursor") |
|
|
|
|
|
|
|
@ -214,15 +250,14 @@ return { |
|
|
map("n", "<leader>dws", builtin.lsp_dynamic_workspace_symbols, "Dynamic workspace symbols") |
|
|
map("n", "<leader>dws", builtin.lsp_dynamic_workspace_symbols, "Dynamic workspace symbols") |
|
|
|
|
|
|
|
|
-- Utilities |
|
|
-- Utilities |
|
|
map("n", "<leader>u", "<cmd>Telescope undo<cr>", "Undo history") |
|
|
|
|
|
map("n", "<leader>ss", builtin.spell_suggest, "Spell suggestions") |
|
|
|
|
|
map("n", "<leader>m", builtin.marks, "Marks") |
|
|
|
|
|
map("n", "<leader>cc", builtin.commands, "Commands") |
|
|
|
|
|
map("n", "<leader>ch", builtin.command_history, "Command history") |
|
|
|
|
|
map("n", "<leader>vh", builtin.help_tags, "Help tags") |
|
|
|
|
|
|
|
|
map("n", "<leader>fu", "<cmd>Telescope undo<cr>", "Undo history") |
|
|
|
|
|
map("n", "<leader>fs", builtin.spell_suggest, "Spell suggestions") |
|
|
|
|
|
map("n", "<leader>fm", builtin.marks, "Marks") |
|
|
|
|
|
map("n", "<leader>fh", builtin.command_history, "Command history") |
|
|
|
|
|
map("n", "<leader>fH", builtin.help_tags, "Help tags") |
|
|
|
|
|
|
|
|
-- Quickfix |
|
|
-- Quickfix |
|
|
map("n", "<leader>ql", builtin.quickfix, "Quickfix list") |
|
|
|
|
|
map("n", "<leader>qhl", builtin.quickfixhistory, "Quickfix history") |
|
|
|
|
|
|
|
|
map("n", "<leader>fq", builtin.quickfix, "Quickfix list") |
|
|
|
|
|
map("n", "<leader>fQ", builtin.quickfixhistory, "Quickfix history") |
|
|
end, |
|
|
end, |
|
|
} |
|
|
} |