nixos-dotfiles
nixos-dotfiles
https://git.tonybtw.com/nixos-dotfiles.git
git://git.tonybtw.com/nixos-dotfiles.git
Reverted back to master treesitter
Diff
diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua
index 495ac8c..32815ad 100644
--- a/after/plugin/treesitter.lua
+++ b/after/plugin/treesitter.lua
@@ -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",
-}
-
-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({
diff --git a/lua/manage.lua b/lua/manage.lua
index 50989f3..97d24c0 100644
--- a/lua/manage.lua
+++ b/lua/manage.lua
@@ -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
diff --git a/lua/plugin-list.lua b/lua/plugin-list.lua
index 02f3925..33f3d4c 100644
--- a/lua/plugin-list.lua
+++ b/lua/plugin-list.lua
@@ -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",
diff --git a/plugin/lsp.lua b/plugin/lsp.lua
index 8bbc49e..9986ca4 100644
--- a/plugin/lsp.lua
+++ b/plugin/lsp.lua
@@ -247,24 +247,34 @@ vim.lsp.config['gopls'] = {
settings = {
gopls = {
analyses = {
- unusedparams = true,
+ unusedparams = false,
+ ST1003 = false,
+ 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