vim.api.nvim_create_autocmd("LspAttach", { group = vim.api.nvim_create_augroup("UserLspConfig", {}), callback = function(ev) -- integrated by default now? -- vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) -- vim.keymap.set('n', "]d", vim.diagnostic.goto_next) -- vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) --vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) --vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) -- --vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) --vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) -- vim.keymap.set("n", "rr", vim.lsp.buf.rename, opts) -- vim.keymap.set("n", "le", vim.diagnostic.open_float) -- vim.keymap.set("n", "i", function() -- require("conform").format({ async = true }) -- -- vim.lsp.buf.format { async = true } -- fallback if without conform -- end, opts) end, }) require("lspconfig").rust_analyzer.setup({ settings = { ["rust-analyzer"] = { imports = { granularity = { group = "module", }, prefix = "self", }, cargo = { buildScripts = { enable = true, }, }, procMacro = { enable = true, }, }, }, }) require("mason").setup({}) require("mason-lspconfig").setup({ -- Replace the language servers listed here -- with the ones you want to install ensure_installed = { "rust_analyzer", "ruff", "quick_lint_js", "html", "cssls", "lua_ls", "vimls" }, }) require("lint").linters_by_ft = { cpp = { "cpplint" }, gdscript = { "gdtoolkit" }, gitcommit = { "commitlint" }, markdown = {}, python = { "ruff" }, } require("lint").config = function() local lint = require("lint") vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, { callback = function() lint.try_lint() end, }) end