viminal2/lua/plugins/telescope.lua

42 lines
1.5 KiB
Lua
Raw Normal View History

2024-10-10 00:21:39 -07:00
return {
2024-10-10 00:48:10 -07:00
"telescope.nvim",
after = function()
require("telescope").setup({
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown({}),
},
},
})
2024-10-10 00:21:39 -07:00
2024-10-10 00:48:10 -07:00
require("telescope").load_extension("ui-select")
2024-10-10 00:21:39 -07:00
2024-10-10 00:48:10 -07:00
local builtin = require("telescope.builtin")
2024-10-10 00:21:39 -07:00
2024-10-10 00:48:10 -07:00
vim.keymap.set("n", "<leader> ", function()
local is_git = vim.fn.finddir(".git", vim.fn.getcwd() .. ";")
if is_git then
builtin.git_files()
else
builtin.find_files()
end
end, { desc = "Grep through all files tracked by git, or fall back to just cwd" })
2024-10-10 00:21:39 -07:00
2024-10-10 00:48:10 -07:00
vim.keymap.set("n", "<leader>ff", builtin.find_files, { desc = "Grep through all files in cwd" })
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action)
vim.keymap.set("n", "<leader>/", builtin.live_grep)
vim.keymap.set("n", "<leader>k", builtin.buffers)
vim.keymap.set("n", "<leader>gd", builtin.lsp_definitions, { desc = "Go to LSP definition" })
vim.keymap.set("n", "<leader>gi", builtin.lsp_implementations, { desc = "Go to implementations" })
vim.keymap.set("n", "<leader>j", builtin.lsp_document_symbols, { desc = "Search through document symbols" })
vim.keymap.set(
"n",
"<leader>fs",
builtin.lsp_workspace_symbols,
{ desc = "Search through entire workspace symbols" }
)
vim.keymap.set("n", "<leader>fd", builtin.diagnostics, { desc = "Search through LSP diagnostics" })
end,
priority = 60,
2024-10-10 00:21:39 -07:00
}