diff --git a/home/private_dot_config/nvim/lua/config/lazy.lua b/home/private_dot_config/nvim/lua/config/lazy.lua index 0a15031..6b4c931 100644 --- a/home/private_dot_config/nvim/lua/config/lazy.lua +++ b/home/private_dot_config/nvim/lua/config/lazy.lua @@ -17,6 +17,7 @@ require("lazy").setup({ { import = "lazyvim.plugins.extras.lang.markdown" }, { import = "lazyvim.plugins.extras.lsp.none-ls" }, { import = "plugins" }, + { import = "plugins.language" }, }, defaults = { -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. diff --git a/home/private_dot_config/nvim/lua/plugins/builtins.lua b/home/private_dot_config/nvim/lua/plugins/builtins.lua index 6943160..937f9aa 100644 --- a/home/private_dot_config/nvim/lua/plugins/builtins.lua +++ b/home/private_dot_config/nvim/lua/plugins/builtins.lua @@ -24,60 +24,24 @@ return { opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "emoji" } })) end, }, - { - "williamboman/mason.nvim", - opts = { - ensure_installed = { - "stylua", - "shellcheck", - "ruff", - "ruff-lsp", - "lua-language-server", - "nimlsp", - }, - }, - }, - { - "nvimtools/none-ls.nvim", - opts = function() - local nls = require("null-ls") - return { - root_dir = require("null-ls.utils").root_pattern(".null-ls-root", ".neoconf.json", "Makefile", ".git"), - sources = { - nls.builtins.formatting.stylua, - nls.builtins.formatting.shfmt, - nls.builtins.diagnostics.ruff, - nls.builtins.diagnostics.shellcheck, - }, - } - end, - }, { "nvim-treesitter/nvim-treesitter", - opts = { - ensure_installed = { - "bash", - "dockerfile", - "html", - "go", - "javascript", - "json", - "latex", - "lua", - "markdown", - "markdown_inline", - "nix", - "python", - "regex", - "toml", - "tsx", - "typescript", + opts = function(_, opts) + opts.ensure_installed = vim.list_extend(opts.ensure_installed or {}, { "vim", "vimdoc", + "html", + "toml", + "json", "yaml", - "yuck", - "zig", - }, - }, + + "go", + "regex", + + "javascript", + "tsx", + "typescript", + }) + end, }, } diff --git a/home/private_dot_config/nvim/lua/plugins/host.lua b/home/private_dot_config/nvim/lua/plugins/host.lua index f297463..45e13e2 100644 --- a/home/private_dot_config/nvim/lua/plugins/host.lua +++ b/home/private_dot_config/nvim/lua/plugins/host.lua @@ -3,8 +3,6 @@ local plugins = {} local single_host_plugins = { othalan = { - -- https://github.com/nvim-treesitter/nvim-treesitter/pull/5437 - -- { "aMOPel/nvim-treesitter-nim" } { "kaarmu/typst.vim" }, { "mickael-menu/zk-nvim", diff --git a/home/private_dot_config/nvim/lua/plugins/language/lua.lua b/home/private_dot_config/nvim/lua/plugins/language/lua.lua new file mode 100644 index 0000000..f768a69 --- /dev/null +++ b/home/private_dot_config/nvim/lua/plugins/language/lua.lua @@ -0,0 +1,26 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + opts.ensure_installed = vim.list_extend(opts.ensure_installed or {}, { "lua" }) + end, + }, + { + "nvimtools/none-ls.nvim", + opts = function(_, opts) + local nls = require("null-ls") + opts.sources = vim.list_extend(opts.sources or {}, { + nls.builtins.formatting.stylua, + }) + end, + }, + { + "williamboman/mason.nvim", + opts = function(_, opts) + opts.ensure_installed = vim.list_extend(opts.ensure_installed or {}, { + "stylua", + "lua-language-server", + }) + end, + }, +} diff --git a/home/private_dot_config/nvim/lua/plugins/languages.lua b/home/private_dot_config/nvim/lua/plugins/language/misc.lua similarity index 100% rename from home/private_dot_config/nvim/lua/plugins/languages.lua rename to home/private_dot_config/nvim/lua/plugins/language/misc.lua diff --git a/home/private_dot_config/nvim/lua/plugins/language/nim.lua b/home/private_dot_config/nvim/lua/plugins/language/nim.lua new file mode 100644 index 0000000..00ae5d0 --- /dev/null +++ b/home/private_dot_config/nvim/lua/plugins/language/nim.lua @@ -0,0 +1,25 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { "nim", "nim_format_string" }) + end + end, + }, + { + "williamboman/mason.nvim", + opts = function(_, opts) + opts.ensure_installed = vim.list_extend(opts.ensure_installed or {}, { + "nimlsp", + }) + end, + }, + { + "nvimtools/none-ls.nvim", + opts = function(_, opts) + local nls = require("null-ls") + table.insert(opts.sources or {}, nls.builtins.formatting.nimpretty) + end, + }, +} diff --git a/home/private_dot_config/nvim/lua/plugins/language/python.lua b/home/private_dot_config/nvim/lua/plugins/language/python.lua new file mode 100644 index 0000000..eef788d --- /dev/null +++ b/home/private_dot_config/nvim/lua/plugins/language/python.lua @@ -0,0 +1,60 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { "python", "toml" }) + end + end, + }, + { + "williamboman/mason.nvim", + opts = function(_, opts) + if type(opts.ensure_installed) == "table" then + vim.list_extend(opts.ensure_installed, { "ruff", "ruff-lsp" }) + end + end, + }, + { + "nvimtools/none-ls.nvim", + opts = function(_, opts) + local nls = require("null-ls") + table.insert(opts.sources or {}, nls.builtins.formatting.ruff) + end, + }, + -- modified from https://www.lazyvim.org/extras/lang/python#nvim-lspconfig + { + "neovim/nvim-lspconfig", + opts = { + servers = { + ruff_lsp = { + keys = { + { + "co", + function() + vim.lsp.buf.code_action({ + apply = true, + context = { + only = { "source.organizeImports" }, + diagnostics = {}, + }, + }) + end, + desc = "Organize Imports", + }, + }, + }, + }, + setup = { + ruff_lsp = function() + require("lazyvim.util").lsp.on_attach(function(client, _) + if client.name == "ruff_lsp" then + -- Disable hover in favor of Pyright + client.server_capabilities.hoverProvider = false + end + end) + end, + }, + }, + }, +} diff --git a/home/private_dot_config/nvim/lua/plugins/language/shell.lua b/home/private_dot_config/nvim/lua/plugins/language/shell.lua new file mode 100644 index 0000000..3d2b9c8 --- /dev/null +++ b/home/private_dot_config/nvim/lua/plugins/language/shell.lua @@ -0,0 +1,25 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + opts.ensure_installed = vim.list_extend(opts.ensure_installed or {}, { "bash" }) + end, + }, + { + "nvimtools/none-ls.nvim", + opts = function(_, opts) + local nls = require("null-ls") + opts.sources = vim.list_extend(opts.sources or {}, { + nls.builtins.diagnostics.shellcheck, + }) + end, + }, + { + "williamboman/mason.nvim", + opts = function(_, opts) + opts.ensure_installed = vim.list_extend(opts.ensure_installed or {}, { + "shellcheck", + }) + end, + }, +} diff --git a/home/private_dot_config/nvim/lua/plugins/lsp.lua b/home/private_dot_config/nvim/lua/plugins/lsp.lua deleted file mode 100644 index ef4d5c9..0000000 --- a/home/private_dot_config/nvim/lua/plugins/lsp.lua +++ /dev/null @@ -1,41 +0,0 @@ --- local function add_words() --- local path = vim.fn.stdpath("config") .. "/spell/en.utf-8.add" --- local words = {} --- for word in io.open(path, "r"):lines() do --- table.insert(words, word) --- end --- return words --- end --- -return { - "neovim/nvim-lspconfig", - opts = { - servers = { - -- ltex = { - -- settings = { - -- ltex = { - -- dictionary = { ["en-US"] = add_words() }, - -- }, - -- }, - -- }, - pylsp = { - settings = { - pylsp = { - plugins = { - -- I'll do the formatting myself - autopep8 = { enabled = false }, - mccabe = { enabled = false }, - pycodestyle = { enabled = false }, - pyflakes = { enabled = false }, - yapf = { enabled = false }, - ruff = { - enabled = true, - extendSelect = { "I" }, - }, - }, - }, - }, - }, - }, - }, -}