neovim refactor for the ages

This commit is contained in:
Daylin Morgan 2023-11-30 14:25:23 -06:00
parent f374536df1
commit 18e2ae58fb
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F
9 changed files with 151 additions and 93 deletions

View file

@ -17,6 +17,7 @@ require("lazy").setup({
{ 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" },
}, },
defaults = { defaults = {
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.

View file

@ -24,60 +24,24 @@ return {
opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "emoji" } })) opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "emoji" } }))
end, 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", "nvim-treesitter/nvim-treesitter",
opts = { opts = function(_, opts)
ensure_installed = { opts.ensure_installed = vim.list_extend(opts.ensure_installed or {}, {
"bash",
"dockerfile",
"html",
"go",
"javascript",
"json",
"latex",
"lua",
"markdown",
"markdown_inline",
"nix",
"python",
"regex",
"toml",
"tsx",
"typescript",
"vim", "vim",
"vimdoc", "vimdoc",
"html",
"toml",
"json",
"yaml", "yaml",
"yuck",
"zig", "go",
}, "regex",
},
"javascript",
"tsx",
"typescript",
})
end,
}, },
} }

View file

@ -3,8 +3,6 @@ local plugins = {}
local single_host_plugins = { local single_host_plugins = {
othalan = { othalan = {
-- https://github.com/nvim-treesitter/nvim-treesitter/pull/5437
-- { "aMOPel/nvim-treesitter-nim" }
{ "kaarmu/typst.vim" }, { "kaarmu/typst.vim" },
{ {
"mickael-menu/zk-nvim", "mickael-menu/zk-nvim",

View file

@ -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,
},
}

View file

@ -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,
},
}

View file

@ -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 = {
{
"<leader>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,
},
},
},
}

View file

@ -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,
},
}

View file

@ -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" },
},
},
},
},
},
},
},
}