nvim: lsp/keymappings: Move the diagnostic key mappings outside of LSP
vim.diagnostic framework is now available and can be used outside of LSP. This means the same functions can now work for plugins providing diagnostics via this framework like nvim-lint and null-ls.
This commit is contained in:
parent
ff93725694
commit
068dfcd4b9
2 changed files with 9 additions and 7 deletions
|
@ -137,3 +137,12 @@ remap('n', 'gm', '`', { noremap = false })
|
||||||
remap('n', '<Leader>mc', ':norm `.<CR>' , opts)
|
remap('n', '<Leader>mc', ':norm `.<CR>' , opts)
|
||||||
remap('n', '<Leader>mi', ':norm `^<CR>' , opts)
|
remap('n', '<Leader>mi', ':norm `^<CR>' , opts)
|
||||||
remap('n', '<Leader>mj', ':norm `\'<CR>', opts)
|
remap('n', '<Leader>mj', ':norm `\'<CR>', opts)
|
||||||
|
|
||||||
|
remap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev { wrap = false }<CR>' , opts)
|
||||||
|
remap('n', ']d', '<cmd>lua vim.diagnostic.goto_next { wrap = false }<CR>' , opts)
|
||||||
|
remap('n', '[D', '<cmd>lua vim.diagnostic.goto_prev()<CR>' , opts)
|
||||||
|
remap('n', ']D', '<cmd>lua vim.diagnostic.goto_next()<CR>' , opts)
|
||||||
|
remap('n', 'dl', '<cmd>lua vim.diagnostic.setloclist()<CR>' , opts)
|
||||||
|
remap('n', 'dq', '<cmd>lua vim.diagnostic.setqflist()<CR>' , opts)
|
||||||
|
remap('n', ',D', '<cmd>lua vim.diagnostic.show_line_diagnostics()<CR>' , opts)
|
||||||
|
remap('n', ',d', '<cmd>lua vim.diagnostic.show_position_diagnostics()<CR>', opts)
|
||||||
|
|
|
@ -118,13 +118,6 @@ local on_attach = function(client, bufnr)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gR' , '<cmd>lua vim.lsp.buf.rename()<CR>' , opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gR' , '<cmd>lua vim.lsp.buf.rename()<CR>' , opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'pd' , '<cmd>lua PeekDefinition()<CR>' , opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'pd' , '<cmd>lua PeekDefinition()<CR>' , opts)
|
||||||
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev { wrap = false }<CR>', opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next { wrap = false }<CR>', opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '[D', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>' , opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', ']D', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>' , opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'do', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>' , opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', ',d', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>' , opts)
|
|
||||||
|
|
||||||
if client.resolved_capabilities.document_range_formatting then
|
if client.resolved_capabilities.document_range_formatting then
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'x', 'gq', '<cmd>lua format_range_operator()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'x', 'gq', '<cmd>lua format_range_operator()<CR>', opts)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue