adjust lsp keymaps
This commit is contained in:
parent
b46abe21c2
commit
75360d1f69
@ -2,3 +2,4 @@ indent_type = "Tabs"
|
||||
indent_width = 4
|
||||
quote_style = "AutoPreferSingle"
|
||||
call_parentheses = "Always"
|
||||
column_width = 150
|
||||
|
@ -52,33 +52,13 @@ function M.config()
|
||||
local function lsp_keymaps(bufnr)
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(
|
||||
bufnr,
|
||||
'n',
|
||||
'gl',
|
||||
"<cmd>lua vim.diagnostic.open_float({ source = false, prefix = function(d, i, ttl) return string.rep(' ', #tostring(ttl) - #tostring(i)) .. tostring(i) .. ': ', nil end })<CR>",
|
||||
opts
|
||||
)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'go', '<cmd>lua vim.diagnostic.open_float()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(
|
||||
bufnr,
|
||||
'n',
|
||||
'[d',
|
||||
'<cmd>lua vim.diagnostic.goto_prev({ border = "rounded" })<CR>',
|
||||
opts
|
||||
)
|
||||
vim.api.nvim_buf_set_keymap(
|
||||
bufnr,
|
||||
'n',
|
||||
']d',
|
||||
'<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>',
|
||||
opts
|
||||
)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>ll', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>lf', '<cmd>lua vim.lsp.buf.formatting_sync()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '[d', '<cmd>lua vim.diagnostic.goto_prev({ border = "rounded" })<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', ']d', '<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>lf', '<cmd>lua vim.lsp.buf.format()<CR>', opts)
|
||||
--vim.cmd [[ command! Format execute 'lua vim.lsp.buf.formatting()' ]]
|
||||
end
|
||||
|
||||
@ -120,7 +100,7 @@ function M.config()
|
||||
-- cmd = { '/home/peters/src/invsys/docker-path/pyright-langserver', '--stdio' },
|
||||
-- cmd = { 'pyright-langserver', '--stdio' },
|
||||
on_attach = on_attach,
|
||||
root_dir = require'lspconfig.util'.root_pattern("pyproject.toml"),
|
||||
root_dir = require('lspconfig.util').root_pattern('pyproject.toml'),
|
||||
settings = {
|
||||
python = {
|
||||
analysis = {
|
||||
@ -139,10 +119,11 @@ function M.config()
|
||||
settings = {
|
||||
args = {
|
||||
-- disable distracting whitespace rules
|
||||
"--ignore", "W291,W293",
|
||||
'--ignore',
|
||||
'W291,W293',
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- vscode-json-language-server
|
||||
|
Loading…
Reference in New Issue
Block a user