diff --git a/lua/astrocommunity/recipes/telescope-lsp-mappings/init.lua b/lua/astrocommunity/recipes/telescope-lsp-mappings/init.lua index 9d73e1cd6..c8d6a2a38 100644 --- a/lua/astrocommunity/recipes/telescope-lsp-mappings/init.lua +++ b/lua/astrocommunity/recipes/telescope-lsp-mappings/init.lua @@ -2,22 +2,31 @@ return { "AstroNvim/astrolsp", ---@param opts AstroLSPOpts opts = function(_, opts) - opts.mappings.n.gd[1] = function() require("telescope.builtin").lsp_definitions { reuse_win = true } end - opts.mappings.n.gI[1] = function() require("telescope.builtin").lsp_implementations { reuse_win = true } end - opts.mappings.n.gr[1] = function() require("telescope.builtin").lsp_references() end - opts.mappings.n.gy[1] = function() require("telescope.builtin").lsp_type_definitions { reuse_win = true } end - opts.mappings.n["lG"][1] = function() - vim.ui.input({ prompt = "Symbol Query: (leave empty for word under cursor)" }, function(query) - if query then - -- word under cursor if given query is empty - if query == "" then query = vim.fn.expand "" end - require("telescope.builtin").lsp_workspace_symbols { - query = query, - prompt_title = ("Find word (%s)"):format(query), - } - end - end) + if opts.mappings.n.gd then + opts.mappings.n.gd[1] = function() require("telescope.builtin").lsp_definitions { reuse_win = true } end + end + if opts.mappings.n.gI then + opts.mappings.n.gI[1] = function() require("telescope.builtin").lsp_implementations { reuse_win = true } end + end + if opts.mappings.n.gy then + opts.mappings.n.gy[1] = function() require("telescope.builtin").lsp_type_definitions { reuse_win = true } end + end + if opts.mappings.n["lG"] then + opts.mappings.n["lG"][1] = function() + vim.ui.input({ prompt = "Symbol Query: (leave empty for word under cursor)" }, function(query) + if query then + -- word under cursor if given query is empty + if query == "" then query = vim.fn.expand "" end + require("telescope.builtin").lsp_workspace_symbols { + query = query, + prompt_title = ("Find word (%s)"):format(query), + } + end + end) + end + end + if opts.mappings.n["lR"] then + opts.mappings.n["lR"][1] = function() require("telescope.builtin").lsp_references() end end - opts.mappings.n["lR"][1] = function() require("telescope.builtin").lsp_references() end end, }