mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-31 15:19:26 +02:00
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:
parent
66bf89c3d1
commit
41b5a28624
2 changed files with 22 additions and 19 deletions
1
init.lua
1
init.lua
|
@ -22,6 +22,7 @@ require("settings").load_commands()
|
||||||
require("core.autocmds").define_augroups(lvim.autocommands)
|
require("core.autocmds").define_augroups(lvim.autocommands)
|
||||||
|
|
||||||
require "keymappings"
|
require "keymappings"
|
||||||
|
require("lsp").setup_default_bindings()
|
||||||
|
|
||||||
local plugins = require "plugins"
|
local plugins = require "plugins"
|
||||||
local plugin_loader = require("plugin-loader").init()
|
local plugin_loader = require("plugin-loader").init()
|
||||||
|
|
|
@ -38,26 +38,28 @@ vim.fn.sign_define(
|
||||||
-- { noremap = true, silent = true }
|
-- { noremap = true, silent = true }
|
||||||
-- )
|
-- )
|
||||||
|
|
||||||
if lvim.lsp.default_keybinds then
|
function lsp_config.setup_default_bindings()
|
||||||
vim.cmd "nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>"
|
if lvim.lsp.default_keybinds then
|
||||||
vim.cmd "nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>"
|
vim.cmd "nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>"
|
||||||
vim.cmd "nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>"
|
vim.cmd "nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>"
|
||||||
vim.cmd "nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>"
|
vim.cmd "nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>"
|
||||||
vim.api.nvim_set_keymap(
|
vim.cmd "nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>"
|
||||||
"n",
|
vim.api.nvim_set_keymap(
|
||||||
"gl",
|
"n",
|
||||||
'<cmd>lua vim.lsp.diagnostic.show_line_diagnostics({ show_header = false, border = "single" })<CR>',
|
"gl",
|
||||||
{ noremap = true, silent = true }
|
'<cmd>lua vim.lsp.diagnostic.show_line_diagnostics({ show_header = false, border = "single" })<CR>',
|
||||||
)
|
{ noremap = true, silent = true }
|
||||||
|
)
|
||||||
|
|
||||||
vim.cmd "nnoremap <silent> gp <cmd>lua require'lsp'.PeekDefinition()<CR>"
|
vim.cmd "nnoremap <silent> gp <cmd>lua require'lsp'.PeekDefinition()<CR>"
|
||||||
vim.cmd "nnoremap <silent> K :lua vim.lsp.buf.hover()<CR>"
|
vim.cmd "nnoremap <silent> K :lua vim.lsp.buf.hover()<CR>"
|
||||||
vim.cmd "nnoremap <silent> <C-p> :lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = lvim.lsp.popup_border}})<CR>"
|
vim.cmd "nnoremap <silent> <C-p> :lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = lvim.lsp.popup_border}})<CR>"
|
||||||
vim.cmd "nnoremap <silent> <C-n> :lua vim.lsp.diagnostic.goto_next({popup_opts = {border = lvim.lsp.popup_border}})<CR>"
|
vim.cmd "nnoremap <silent> <C-n> :lua vim.lsp.diagnostic.goto_next({popup_opts = {border = lvim.lsp.popup_border}})<CR>"
|
||||||
vim.cmd "nnoremap <silent> <tab> <cmd>lua vim.lsp.buf.signature_help()<CR>"
|
vim.cmd "nnoremap <silent> <tab> <cmd>lua vim.lsp.buf.signature_help()<CR>"
|
||||||
-- scroll down hover doc or scroll in definition preview
|
-- scroll down hover doc or scroll in definition preview
|
||||||
-- scroll up hover doc
|
-- scroll up hover doc
|
||||||
vim.cmd 'command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()'
|
vim.cmd 'command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set Default Prefix.
|
-- Set Default Prefix.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue