From 75360d1f69d2f9c6e302c19e72b4c3850adde83b Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Tue, 9 Jan 2024 13:43:28 -0800 Subject: [PATCH] adjust lsp keymaps --- .stylua.toml | 1 + lua/configs/lspconfig.lua | 35 ++++++++--------------------------- 2 files changed, 9 insertions(+), 27 deletions(-) diff --git a/.stylua.toml b/.stylua.toml index 7e75525..13ef6d3 100644 --- a/.stylua.toml +++ b/.stylua.toml @@ -2,3 +2,4 @@ indent_type = "Tabs" indent_width = 4 quote_style = "AutoPreferSingle" call_parentheses = "Always" +column_width = 150 diff --git a/lua/configs/lspconfig.lua b/lua/configs/lspconfig.lua index ba4809f..f0ce6cf 100644 --- a/lua/configs/lspconfig.lua +++ b/lua/configs/lspconfig.lua @@ -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', 'lua vim.lsp.buf.hover()', opts) - vim.api.nvim_buf_set_keymap( - bufnr, - 'n', - 'gl', - "lua vim.diagnostic.open_float({ source = false, prefix = function(d, i, ttl) return string.rep(' ', #tostring(ttl) - #tostring(i)) .. tostring(i) .. ': ', nil end })", - opts - ) vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', 'lua vim.lsp.buf.declaration()', opts) vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'lua vim.lsp.buf.definition()', opts) vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', 'lua vim.lsp.buf.implementation()', opts) vim.api.nvim_buf_set_keymap(bufnr, 'n', 'go', 'lua vim.diagnostic.open_float()', opts) - vim.api.nvim_buf_set_keymap( - bufnr, - 'n', - '[d', - 'lua vim.diagnostic.goto_prev({ border = "rounded" })', - opts - ) - vim.api.nvim_buf_set_keymap( - bufnr, - 'n', - ']d', - 'lua vim.diagnostic.goto_next({ border = "rounded" })', - opts - ) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'll', 'lua vim.diagnostic.setloclist()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lf', 'lua vim.lsp.buf.formatting_sync()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', '[d', 'lua vim.diagnostic.goto_prev({ border = "rounded" })', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', ']d', 'lua vim.diagnostic.goto_next({ border = "rounded" })', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lf', 'lua vim.lsp.buf.format()', 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