]> git.rmz.io Git - dotfiles.git/blobdiff - nvim/lua/plugins/lsp.lua
nvim: allow normal mode in lsp.rename() popup
[dotfiles.git] / nvim / lua / plugins / lsp.lua
index cfb909a6b32cc12340f88e91bf4d44a5ae007210..509841c6a3d2b3c892f95a0a42b01b1843551b8d 100644 (file)
@@ -28,25 +28,6 @@ return {
         },
         -- Add clangd extensions
         -- https://github.com/p00f/clangd_extensions.nvim
         },
         -- Add clangd extensions
         -- https://github.com/p00f/clangd_extensions.nvim
-        ruff_lsp = {
-          root_dir = function(fname)
-            return require("lspconfig.util").root_pattern("pyproject.toml", "setup.cfg", "ruff.toml")(fname)
-          end,
-        },
-        pylsp = {
-          settings = {
-            pylsp = {
-              plugins = {
-                autopep8 = { enabled = false },
-                flake8 = { enabled = false },
-                mccabe = { enabled = false },
-                pycodestyle = { enabled = false },
-                pydocstyle = { enabled = false },
-                pyflakes = { enabled = false },  -- covered by flake8
-              }
-            }
-          }
-        }
       },
       -- you can do any additional lsp server setup here
       -- return true if you don't want this server to be setup with lspconfig
       },
       -- you can do any additional lsp server setup here
       -- return true if you don't want this server to be setup with lspconfig
@@ -62,4 +43,37 @@ return {
       },
     },
   },
       },
     },
   },
+
+  -- cmdline tools and lsp servers
+  {
+
+    "williamboman/mason.nvim",
+    cmd = "Mason",
+    keys = { { "<leader>cm", "<cmd>Mason<cr>", desc = "Mason" } },
+    opts = {
+      ensure_installed = {
+        "stylua",
+        "shfmt",
+        -- "flake8",
+      },
+    },
+    ---@param opts MasonSettings | {ensure_installed: string[]}
+    config = function(_, opts)
+      require("mason").setup(opts)
+      local mr = require("mason-registry")
+      local function ensure_installed()
+        for _, tool in ipairs(opts.ensure_installed) do
+          local p = mr.get_package(tool)
+          if not p:is_installed() then
+            p:install()
+          end
+        end
+      end
+      if mr.refresh then
+        mr.refresh(ensure_installed)
+      else
+        ensure_installed()
+      end
+    end,
+  },
 }
 }