Updated nvim conf.

This commit is contained in:
tonybanters 2026-02-09 21:58:37 -08:00
commit 6ce92dfc24
4 changed files with 30 additions and 79 deletions

View file

@ -1,36 +1,29 @@
vim.filetype.add({ extension = { goon = "goon" } })
require("nvim-treesitter.parsers").goon = {
-- Register custom goon parser with treesitter (old API)
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.goon = {
install_info = {
path = "/home/tony/repos/tree-sitter-goon",
url = "/home/tony/repos/tree-sitter-goon",
files = { "src/parser.c" },
queries = "queries",
},
filetype = "goon",
}
local ts = require("nvim-treesitter")
ts.setup({
install_dir = vim.fn.stdpath("data") .. "/site",
})
local parsers = {
"json", "python", "ron", "javascript", "haskell", "d", "query",
"typescript", "tsx", "rust", "zig", "php", "yaml", "html", "css",
"markdown", "markdown_inline", "bash", "lua", "vim", "vimdoc", "c",
"dockerfile", "gitignore", "astro", "nim", "go"
}
vim.api.nvim_create_user_command("TSInstallAll", function()
ts.install(parsers)
end, {})
vim.api.nvim_create_autocmd("FileType", {
pattern = "*",
callback = function()
pcall(vim.treesitter.start)
end,
-- Configure nvim-treesitter with ensure_installed
require("nvim-treesitter.configs").setup({
ensure_installed = {
"json", "python", "ron", "javascript", "haskell", "d", "query",
"typescript", "tsx", "rust", "zig", "php", "yaml", "html", "css",
"markdown", "markdown_inline", "bash", "lua", "vim", "vimdoc", "c",
"dockerfile", "gitignore", "astro", "go", "templ"
},
highlight = {
enable = true,
},
indent = {
enable = true,
},
})
require("nvim-treesitter-textobjects").setup({

View file

@ -1,4 +1,3 @@
---@diagnostic disable: undefined-field
local M = {}
local plug_dir = vim.fn.stdpath("data") .. "/plugins"
@ -33,54 +32,4 @@ function M.setup()
end
end
function M.update()
local handle = vim.uv.fs_scandir(plug_dir)
if not handle then return print("No plugins installed") end
while true do
local name, t = vim.uv.fs_scandir_next(handle)
if not name then break end
if t == "directory" then
print("Updating " .. name .. "...")
vim.fn.system({ "git", "-C", plug_dir .. "/" .. name, "pull", "--ff-only" })
end
end
print("Done!")
end
function M.list()
local handle = vim.uv.fs_scandir(plug_dir)
if not handle then return print("No plugins installed") end
while true do
local name, t = vim.uv.fs_scandir_next(handle)
if not name then break end
if t == "directory" then print(name) end
end
end
function M.clean()
local installed = {}
local handle = vim.uv.fs_scandir(plug_dir)
if handle then
while true do
local name, t = vim.uv.fs_scandir_next(handle)
if not name then break end
if t == "directory" then installed[name] = true end
end
end
local wanted = {}
for _, spec in ipairs(require("plugin-list")) do
local repo = type(spec) == "string" and spec or spec[1]
wanted[repo:match(".+/(.+)$")] = true
end
for name in pairs(installed) do
if not wanted[name] then
print("Removing " .. name .. "...")
vim.fn.delete(plug_dir .. "/" .. name, "rf")
end
end
print("Done!")
end
return M

View file

@ -1,7 +1,7 @@
return {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
{ "nvim-treesitter/nvim-treesitter", branch = "main" },
{ "nvim-treesitter/nvim-treesitter", branch = "master" },
{ "nvim-treesitter/nvim-treesitter-textobjects", branch = "main" },
"nvim-treesitter/nvim-treesitter-context",
"hrsh7th/nvim-cmp",

View file

@ -247,25 +247,34 @@ vim.lsp.config['gopls'] = {
settings = {
gopls = {
analyses = {
unusedparams = false,
ST1003 = false,
unusedparams = true,
ST1000 = false,
},
staticcheck = true,
},
},
}
vim.lsp.config['templ'] = {
cmd = { 'templ', 'lsp' },
filetypes = { 'templ' },
root_markers = { 'go.mod', '.git' },
capabilities = caps,
}
vim.filetype.add({
extension = {
h = 'c',
c3 = 'c3',
d = 'd',
templ = 'templ',
},
})
---@diagnostic disable-next-line: invisible
for name, _ in pairs(vim.lsp.config._configs) do
if name ~= '*' then -- Skip the wildcard config
if name ~= '*' then
vim.lsp.enable(name)
end
end