diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index 62fd9d9..3ed8b73 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -42,8 +42,9 @@ "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, "luarocks.nvim": { "branch": "main", "commit": "1db9093915eb16ba2473cfb8d343ace5ee04130a" }, "markmap.nvim": { "branch": "main", "commit": "5fb6755cf5434511cc23a4936c9eb76b9142fba5" }, + "mason-conform.nvim": { "branch": "main", "commit": "abce2be529f3b4b336c56d0ba6336a9144e0fee6" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "9ae570e206360e47d30b4c35a4550c165f4ea7b7" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, + "mason-nvim-lint": { "branch": "main", "commit": "637a5b8f1b454753ec70289c4996d88a50808642" }, "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" }, "mdeval.nvim": { "branch": "master", "commit": "2c32e2f3e7d8f222e7a4724989f218d036e1081d" }, "mini.nvim": { "branch": "main", "commit": "19e1584124cda35388d4fdb911eab7124014e541" }, diff --git a/nvim/.config/nvim/lua/plugins/config/lsp.lua b/nvim/.config/nvim/lua/plugins/config/lsp.lua index 080a7c6..3481a46 100644 --- a/nvim/.config/nvim/lua/plugins/config/lsp.lua +++ b/nvim/.config/nvim/lua/plugins/config/lsp.lua @@ -43,17 +43,6 @@ local servers = { yamlls = {}, } --- TODO installed for conform/nvim-lint so should be sourced from there not here -local to_mason = - ---@diagnostic disable-next-line:deprecated - { "stylua", "shellcheck", "shfmt", "markdownlint", "bibtex-tidy", "jq", "prettier", "ruff", unpack(servers) } -require("mason-tool-installer").setup({ - -- a list of all tools you want to ensure are installed upon - -- start - ensure_installed = to_mason, - start_delay = 3000, -}) - local function on_attach(_, bufnr) local map = vim.keymap.set map("n", "[d", "lua vim.diagnostic.goto_prev()", { buffer = bufnr, desc = "Previous diagnostic" }) @@ -177,7 +166,7 @@ lspconfig.basedpyright.setup({ client.config.settings.python.pythonPath = python_path end, settings = { - -- disable imports and linting since, we use ruff for that + -- disable imports and linting since, we use ruff for that pyright = { disableOrganizeImports = true, }, diff --git a/nvim/.config/nvim/lua/plugins/ide.lua b/nvim/.config/nvim/lua/plugins/ide.lua index b4d3a05..1fd191e 100644 --- a/nvim/.config/nvim/lua/plugins/ide.lua +++ b/nvim/.config/nvim/lua/plugins/ide.lua @@ -96,7 +96,6 @@ return { "williamboman/mason-lspconfig.nvim", cmd = { "LspInstall", "LspUninstall" }, }, - { "WhoIsSethDaniel/mason-tool-installer.nvim" }, }, event = { "BufReadPost", "BufNewFile", "BufWritePre" }, config = function() @@ -104,7 +103,7 @@ return { end, keys = { { "vs", ":LspInfo", desc = "LspInfo" } }, }, - -- very very pretty lsp 'peek' menus + -- pretty lsp 'peek' menus { "DNLHC/glance.nvim", opts = { border = { enable = true }, theme = { enable = true, mode = "auto" } }, @@ -113,85 +112,98 @@ return { -- linting setup { - "mfussenegger/nvim-lint", - config = function() - require("lint").linters_by_ft = linters - vim.api.nvim_create_autocmd({ "BufWritePost", "InsertLeave" }, { - callback = function() - if not vim.g.disable_autolint then - require("lint").try_lint() - end + "rshkarin/mason-nvim-lint", + dependencies = { + { + "mfussenegger/nvim-lint", + config = function() + require("lint").linters_by_ft = linters + vim.api.nvim_create_autocmd({ "BufWritePost", "InsertLeave" }, { + callback = function() + if not vim.g.disable_autolint then + require("lint").try_lint() + end + end, + }) end, - }) - end, + dependencies = { "williamboman/mason.nvim" }, + }, + }, event = { "BufReadPost", "BufNewFile", "BufWritePre" }, + opts = {}, }, -- formatting setup { - "stevearc/conform.nvim", - config = function() - require("conform").setup({ - lsp_fallback = true, - format_after_save = function(bufnr) - if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then - return - end - return { lsp_fallback = true } + "zapling/mason-conform.nvim", + dependencies = { + { + "stevearc/conform.nvim", + config = function() + require("conform").setup({ + lsp_fallback = true, + format_after_save = function(bufnr) + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + return { lsp_fallback = true } + end, + formatters_by_ft = formatters, + formatters = { + -- enable python isort functionality + ruff_fix = { + prepend_args = { "--select", "I" }, + }, + }, + }) + vim.api.nvim_create_user_command("FormatDisable", function(args) + if args.bang then + -- FormatDisable! will disable formatting just for this buffer + vim.b.disable_autoformat = true + else + vim.g.disable_autoformat = true + end + end, { + desc = "Disable formatting on save", + bang = true, + }) + vim.api.nvim_create_user_command("FormatEnable", function() + vim.b.disable_autoformat = false + vim.g.disable_autoformat = false + end, { + desc = "Enable formatting on save", + }) end, - formatters_by_ft = formatters, - formatters = { - -- enable python isort functionality - ruff_fix = { - prepend_args = { "--select", "I" }, + cmd = { "ConformInfo" }, + keys = { + { + "ll", + function() + require("conform").format({ async = true, lsp_fallback = true }) + end, + desc = "Format buffer", + }, + { + "lL", + function() + vim.g.disable_autoformat = not vim.g.disable_autoformat + end, + desc = "Toggle AutoFormat", + }, + { + "vf", + ":ConformInfo", + desc = "ConformInfo", }, }, - }) - vim.api.nvim_create_user_command("FormatDisable", function(args) - if args.bang then - -- FormatDisable! will disable formatting just for this buffer - vim.b.disable_autoformat = true - else - vim.g.disable_autoformat = true - end - end, { - desc = "Disable formatting on save", - bang = true, - }) - vim.api.nvim_create_user_command("FormatEnable", function() - vim.b.disable_autoformat = false - vim.g.disable_autoformat = false - end, { - desc = "Enable formatting on save", - }) - end, - cmd = { "ConformInfo" }, - event = { "BufReadPost", "BufNewFile", "BufWritePre" }, - keys = { - { - "ll", - function() - require("conform").format({ async = true, lsp_fallback = true }) + init = function() + -- If you want the formatexpr, here is the place to set it + vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" end, - desc = "Format buffer", - }, - { - "lL", - function() - vim.g.disable_autoformat = not vim.g.disable_autoformat - end, - desc = "Toggle AutoFormat", - }, - { - "vf", - ":ConformInfo", - desc = "ConformInfo", }, }, - init = function() - -- If you want the formatexpr, here is the place to set it - vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" - end, + event = { "BufReadPost", "BufNewFile", "BufWritePre" }, + opts = {}, }, -- useful quickfix-like buffer