dotfiles/nvim/lua/plugins/30-fuzzyfinder.lua

67 lines
1.9 KiB
Lua

local keymap = vim.keymap.set
return {
"nvim-telescope/telescope.nvim",
event = "VimEnter",
dependencies = {
"nvim-lua/plenary.nvim",
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
cond = function()
return vim.fn.executable("make") == 1
end,
},
"nvim-telescope/telescope-ui-select.nvim",
{
"nvim-tree/nvim-web-devicons",
enabled = vim.g.have_nerd_font,
},
"rcarriga/nvim-notify",
},
config = function()
require("telescope").setup({
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown(),
},
},
})
pcall(require("telescope").load_extension, "fzf")
pcall(require("telescope").load_extension, "ui-select")
pcall(require("telescope").load_extension, "notify")
-- Define these keys here since they require access to runtime values
local builtin = require("telescope.builtin")
local map = function(keys, func, desc)
vim.keymap.set("n", "<leader>" .. keys, func, { desc = "[s]earch " .. desc })
end
map("<leader>", builtin.find_files, "all files ([ ])")
map("sb", builtin.buffers, "[b]uffers")
map("sd", builtin.diagnostics, "[d]iagnostics")
map("sg", builtin.live_grep, "[g]rep")
map("sh", builtin.help_tags, "[h]elp")
map("sk", builtin.keymaps, "[k]eymaps")
map("sn", function()
builtin.find_files({ cwd = vim.fn.stdpath("config") })
end, "[n]eovim files")
map("sr", builtin.resume, "[r]esume")
map("st", builtin.builtin, "[t]elescope")
map("sw", builtin.grep_string, "current [w]ord")
map("s.", builtin.oldfiles, "recent files ([.] for repeat)")
map("/", function()
builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({
winblend = 10,
previewer = false,
}))
end, "current buffer fuzzy ([/])")
map("s/", function()
builtin.live_grep({
grep_open_files = true,
prompt_title = "Live Grep in Open Files",
})
end, "in open files ([/])")
end,
}