Created
May 21, 2025 20:24
-
-
Save eterps/1ca92b14de5583657f67e1f0540ff97b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"mason-org/mason-lspconfig.nvim", | |
opts = { | |
ensure_installed = { 'basedpyright', 'ruff', 'prettierd', 'prettier', 'shfmt', | |
'mdformat', 'standardrb', 'stylua', 'terraform-ls', 'tflint', 'yamlfmt' }, | |
automatic_enable = { | |
exclude = { "lua_ls", "basedpyright" }, | |
} | |
}, | |
dependencies = { | |
{ "mason-org/mason.nvim", opts = {} }, | |
{ | |
"neovim/nvim-lspconfig", | |
config = function() | |
local lc = require 'lspconfig' | |
lc.lua_ls.setup({ | |
settings = { Lua = { diagnostics = { globals = { 'vim', 'describe', 'it' } } } } | |
}) | |
lc.basedpyright.setup { | |
root_dir = lc.util.root_pattern('.git', 'pyrightconfig.json'), | |
settings = { | |
pyright = { | |
-- Using Ruff's import organizer | |
disableOrganizeImports = true, | |
}, | |
python = { | |
analysis = { | |
-- Ignore all files for analysis to exclusively use Ruff for linting | |
ignore = { '*' }, | |
}, | |
}, | |
}, | |
} | |
vim.api.nvim_create_autocmd('LspAttach', { | |
group = vim.api.nvim_create_augroup('UserLspConfig', {}), | |
callback = function(ev) | |
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' | |
local opts = { buffer = ev.buf } | |
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) | |
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts) | |
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts) | |
vim.keymap.set('n', '=', function() | |
vim.lsp.buf.format({ async = true }) | |
end, opts) | |
end, | |
}) | |
end | |
}, | |
}, | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment