From 1ac22e81b24fef5f58f220e6c8424f3a7b07ccdb Mon Sep 17 00:00:00 2001 From: ViViDboarder Date: Wed, 25 Aug 2021 16:28:24 -0700 Subject: [PATCH] Set fuzzy lsp bindings based on installed packages --- neovim/lua/plugins/lsp.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/neovim/lua/plugins/lsp.lua b/neovim/lua/plugins/lsp.lua index 0e4a88c..d2f6566 100644 --- a/neovim/lua/plugins/lsp.lua +++ b/neovim/lua/plugins/lsp.lua @@ -52,13 +52,14 @@ local function default_attach(client, bufnr) ]]) end - -- Some override telescope bindings - -- TODO: Detect telescope or nvim-lspfuzzy and set keymap accordingly - buf_set_keymap("n", "t", "lua vim.lsp.buf.document_symbol()", opts) - -- buf_set_keymap("n", "ft", "lua vim.lsp.buf.workspace_symbol()", opts) - - -- buf_set_keymap("n", "t", "Telescope lsp_document_symbols", opts) - -- buf_set_keymap("n", "ft", "Telescope lsp_dynamic_workspace_symbols", opts) + -- Some override some fuzzy finder bindings to use lsp sources + if packer_plugins["nvim-lspfuzzy"] then + buf_set_keymap("n", "t", "lua vim.lsp.buf.document_symbol()", opts) + -- buf_set_keymap("n", "ft", "lua vim.lsp.buf.workspace_symbol()", opts) + elseif packer_plugins["telescope.nvim"] then + buf_set_keymap("n", "t", "Telescope lsp_document_symbols", opts) + buf_set_keymap("n", "ft", "Telescope lsp_dynamic_workspace_symbols", opts) + end end local function config_lsp()