abstractions away

This commit is contained in:
Daylin Morgan 2023-12-17 23:26:30 -06:00
parent 715a11fae8
commit 889f77ad9d
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F
7 changed files with 39 additions and 70 deletions

View file

@ -14,7 +14,7 @@ require("lazy").setup({
{ import = "lazyvim.plugins.extras.ui.edgy" }, { import = "lazyvim.plugins.extras.ui.edgy" },
{ import = "lazyvim.plugins.extras.lang.tex" }, { import = "lazyvim.plugins.extras.lang.tex" },
{ import = "lazyvim.plugins.extras.lang.docker" }, { import = "lazyvim.plugins.extras.lang.docker" },
{ import = "lazyvim.plugins.extras.lang.markdown" }, -- { import = "lazyvim.plugins.extras.lang.markdown" },
{ import = "lazyvim.plugins.extras.lsp.none-ls" }, { import = "lazyvim.plugins.extras.lsp.none-ls" },
{ import = "plugins" }, { import = "plugins" },
{ import = "plugins.language" }, { import = "plugins.language" },

View file

@ -1,25 +1,11 @@
return { return {
{ require("util").setup_lang({ treesitter = { "lua" }, mason = { "stylua", "lua-language-server" } }),
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = vim.list_extend(opts.ensure_installed or {}, { "lua" })
end,
},
{ {
"nvimtools/none-ls.nvim", "nvimtools/none-ls.nvim",
opts = function(_, opts) opts = function(_, opts)
local nls = require("null-ls") local nls = require("null-ls")
opts.sources = vim.list_extend(opts.sources or {}, { opts.sources = vim.list_extend(opts.sources or {}, {
nls.builtins.formatting.stylua, 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, end,
}, },

View file

@ -0,0 +1,3 @@
return {
require("util").setup_lang({treesitter = {"markdown", "markdown_inline"}})
}

View file

@ -1,25 +1,3 @@
return { return {
{ require("util").setup_lang({ treesitter = { "nim", "nim_format_string" }, mason = { "nimlsp" } }),
"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,
},
} }

View file

@ -1,20 +1,5 @@
return { return {
{ require("util").setup_lang({ treesitter = { "python", "toml" }, mason = { "ruff", "ruff-lsp" } }),
"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", "nvimtools/none-ls.nvim",
opts = function(_, opts) opts = function(_, opts)

View file

@ -1,10 +1,5 @@
return { return {
{ require("util").setup_lang({ treesitter = { "bash" }, mason = { "shellcheck" } }),
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = vim.list_extend(opts.ensure_installed or {}, { "bash" })
end,
},
{ {
"nvimtools/none-ls.nvim", "nvimtools/none-ls.nvim",
opts = function(_, opts) opts = function(_, opts)
@ -14,12 +9,4 @@ return {
}) })
end, end,
}, },
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = vim.list_extend(opts.ensure_installed or {}, {
"shellcheck",
})
end,
},
} }

View file

@ -0,0 +1,30 @@
local function setDefault(t, d)
local mt = {
__index = function()
return d
end,
}
setmetatable(t, mt)
end
local function setup_lang(defs)
setDefault(defs, {})
return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = vim.list_extend(opts.ensure_installed or {}, defs.treesitter)
end,
},
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = vim.list_extend(opts.ensure_installed or {}, defs.mason)
end,
},
}
end
return {
setup_lang = setup_lang,
}