dotfiles/nvim/lua/plugins/fuzzy-finder.lua

93 lines
2.6 KiB
Lua
Raw Normal View History

return {
2023-10-28 04:37:04 +00:00
-- Need a telescope to see your johnsons.
{
"nvim-telescope/telescope.nvim",
depedencies = {
2023-10-28 04:37:04 +00:00
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope-project.nvim",
},
2023-10-28 04:37:04 +00:00
module = true,
config = function()
local telescope = require("telescope")
telescope.setup {
extensions = {
project = {
base_dirs = {
{ "~/library/projects/software", max_depth = 2 },
{ "~/library/projects/packages" },
{ "~/library/writings" },
},
},
},
}
local builtins = require("telescope.builtin")
2023-10-28 04:37:04 +00:00
local opts = { noremap = true }
local get_builtin = function(fun, ...)
local fargs = arg
return function()
builtins[fun](fargs)
end
end
vim.keymap.set(
"n",
"<leader>ff",
get_builtin("find_files", { hidden = true }),
2023-10-28 04:37:04 +00:00
opts
)
vim.keymap.set(
"n",
"<leader>fF",
function()
builtins.find_files {
cwd = require("telescope.utils").buffer_dir(),
hidden = true,
}
end,
2023-10-28 04:37:04 +00:00
opts
)
2023-10-28 04:37:04 +00:00
vim.keymap.set("n", "<leader>fg", get_builtin "grep_string", opts)
vim.keymap.set("n", "<leader>fG", get_builtin "live_grep", opts)
vim.keymap.set("n", "<leader>fb", get_builtin "buffers", opts)
vim.keymap.set("n", "<leader>fh", get_builtin "help_tags", opts)
vim.keymap.set("n", "<leader>ft", get_builtin "treesitter", opts)
vim.keymap.set("n", "<leader>fb", get_builtin "buffers", opts)
vim.keymap.set("n", "<leader>fr", get_builtin "old_files", opts)
vim.keymap.set("n", "<leader>fM", get_builtin "man_pages", opts)
vim.keymap.set(
"n",
"<leader>fR",
get_builtin("old_files", { only_cwd = true }),
2023-10-28 04:37:04 +00:00
opts
)
2023-10-28 04:37:04 +00:00
vim.keymap.set("n", "<leader>fA", get_builtin "resume", opts)
-- Ekeymap.set
vim.keymap.set(
"n",
"<leader>fp",
2023-10-28 04:37:04 +00:00
[[<cmd>lua require("telescope").extensions.project.project({})<cr>]],
opts
)
end,
},
-- Marks in ~~steroids~~ coconut oil
{
"ThePrimeagen/harpoon",
config = function()
vim.keymap.set("n", "<leader>fm", "<cmd>lua require('harpoon.mark').add_file()<cr>", {})
local has_telescope, telescope = pcall("telescope")
if has_telescope then
vim.keymap.set("n", "<leader>fM", "<cmd>lua require('telescope').extensions.harpoon.harpoon({})<cr>", {})
require("telescope").load_extension("harpoon")
end
end,
2023-10-28 04:37:04 +00:00
dependencies = { "nvim-lua/plenary.nvim" },
}
}