Wrap lsp default_keybindings in function instead of load on 1st require (#1128)

Co-authored-by: Johan Melin <johan.melin@paradoxinteractive.com>
This commit is contained in:
devtoi 2021-07-27 16:29:40 +02:00 committed by GitHub
parent 66bf89c3d1
commit 41b5a28624
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 19 deletions

View file

@ -22,6 +22,7 @@ require("settings").load_commands()
require("core.autocmds").define_augroups(lvim.autocommands)
require "keymappings"
require("lsp").setup_default_bindings()
local plugins = require "plugins"
local plugin_loader = require("plugin-loader").init()

View file

@ -38,6 +38,7 @@ vim.fn.sign_define(
-- { noremap = true, silent = true }
-- )
function lsp_config.setup_default_bindings()
if lvim.lsp.default_keybinds then
vim.cmd "nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>"
vim.cmd "nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>"
@ -59,6 +60,7 @@ if lvim.lsp.default_keybinds then
-- scroll up hover doc
vim.cmd 'command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()'
end
end
-- Set Default Prefix.
-- Note: You can set a prefix per lsp server in the lv-globals.lua file