require("telescope").setup({}) require("telescope").load_extension("fzf") local builtin = require("telescope.builtin") vim.keymap.set("n", "pf", builtin.find_files, { desc = "[p]roject [f[uzzy find" }) vim.keymap.set("n", "pg", builtin.git_files, { desc = "[p]roject [g]it files" }) vim.keymap.set("n", "pws", function() local word = vim.fn.expand("") builtin.grep_string({ search = word }) end, { desc = "[p]roject [w]ord [s]earch" }) vim.keymap.set("n", "pWs", function() local word = vim.fn.expand("") builtin.grep_string({ search = word }) end, { desc = "[p]roject [W]ORD [s]earch" }) vim.keymap.set( "n", "ps", function() builtin.grep_string({ search = vim.fn.input("rg > ") }) end, { desc = "[p]roject [s]earch" } ) vim.keymap.set("n", "vh", builtin.help_tags, { desc = "[v]iew [h]elp tags" }) vim.keymap.set("n", "vk", builtin.keymaps, { desc = "[v]iew [k]ey maps" }) vim.api.nvim_create_autocmd("LspAttach", { group = vim.api.nvim_create_augroup("telescope-lsp-attach", { clear = true }), callback = function(event) local buf = event.buf -- Find references for the word under your cursor. vim.keymap.set("n", "grr", builtin.lsp_references, { buffer = buf, desc = "[G]oto [R]eferences" }) -- Jump to the implementation of the word under your cursor. -- Useful when your language has ways of declaring types without an actual implementation. vim.keymap.set("n", "gri", builtin.lsp_implementations, { buffer = buf, desc = "[G]oto [I]mplementation" }) -- Jump to the definition of the word under your cursor. -- This is where a variable was first declared, or where a function is defined, etc. -- To jump back, press . vim.keymap.set("n", "grd", builtin.lsp_definitions, { buffer = buf, desc = "[G]oto [D]efinition" }) -- Fuzzy find all the symbols in your current document. -- Symbols are things like variables, functions, types, etc. vim.keymap.set("n", "gO", builtin.lsp_document_symbols, { buffer = buf, desc = "Open Document Symbols" }) -- Fuzzy find all the symbols in your current workspace. -- Similar to document symbols, except searches over your entire project. vim.keymap.set( "n", "gW", builtin.lsp_dynamic_workspace_symbols, { buffer = buf, desc = "Open Workspace Symbols" } ) -- Jump to the type of the word under your cursor. -- Useful when you're not sure what type a variable is and you want to see -- the definition of its *type*, not where it was *defined*. vim.keymap.set("n", "grt", builtin.lsp_type_definitions, { buffer = buf, desc = "[G]oto [T]ype Definition" }) end, })