Compare commits

...

3 Commits

Author SHA1 Message Date
Buddy
c1a96e788c refactor: self-bootstrap lazy.nvim instead of chezmoi archive external
Replace the chezmoiexternal tarball install with the standard
lazy.nvim bootstrap snippet (clone-if-missing, pinned to v11.17.5,
the current latest stable tag). Gives lazy.nvim a real git checkout
instead of an extracted tarball, and drops chezmoi from the loop
entirely for this one piece - bumping the version is now just
editing the --branch tag in init.lua.
2026-10-24 14:53:55 -07:00
Buddy
3e0402178c fix: resolve lazy.nvim lock crash and erb treesitter crash
Move lazy.nvim's own install outside the lazy plugin root so it's
treated as local and skipped during git-based lock file writes -
installing it as a tarball left it without a .git dir, which crashed
lazy's lock.update() on every sync (assert on Git.info of a non-git
dir).

Also patch nvim-treesitter's set-lang-from-mimetype! directive, which
crashes on any <script type="..."> tag because it reads match[id] as
a single node when Neovim core now always returns an array there.
Hooked on LazyDone so it overrides nvim-treesitter's own registration
instead of being clobbered by it. Added ruby/html/embedded_template
to ensure_installed so TSUpdate actually keeps those parsers current
instead of relying on one-time auto_install.
2026-10-24 14:45:26 -07:00
Buddy
c16ad74d91 chore: cleanup gitignore 2026-10-23 09:17:23 -07:00
4 changed files with 64 additions and 13 deletions

View File

@ -1,8 +0,0 @@
# chezmoi:template:left-delimiter=#{{
#{{- /* vim: set filetype=toml: */ -}}
[".local/share/nvim/lazy/lazy.nvim"]
type = "archive"
url = "https://github.com/folke/lazy.nvim/archive/refs/tags/v11.17.5.tar.gz"
exact = true
stripComponents = 1
refreshPeriod = "2196h"

View File

@ -9,14 +9,10 @@
# vim ignores
.*.sw[a-z]
.netrwhist
doc/tags
# OS X ignores
.DS_Store
.DS_Store?
.AppleDouble
.LSOverride
Icon
# Thumbnails
._*

View File

@ -1,5 +1,24 @@
require("core.config")
vim.opt.runtimepath:prepend(vim.fn.stdpath("data") .. "/lazy/lazy.nvim")
local lazypath = vim.fn.stdpath("data") .. "/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
local out = vim.fn.system({
"git", "clone", "--filter=blob:none",
"--branch=v11.17.5",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.runtimepath:prepend(lazypath)
require("lazy").setup({
spec = {
{ import = "plugins" },

View File

@ -14,11 +14,55 @@ function M.treesitter_configs()
require("nvim-treesitter.configs").setup(M.treesitter_config_setup)
end
-- Works around a crash in nvim-treesitter's bundled `set-lang-from-mimetype!`
-- directive (queries/html_tags/injections.scm, used by html/erb/vue/svelte):
-- it reads `match[capture_id]` as a single TSNode, but current Neovim core
-- always returns an array of nodes there, so `<script type="...">` tags
-- crash the whole buffer's treesitter parse. Re-register the directive with
-- the same behavior, reading the first node out of the array instead.
--
-- Must run after nvim-treesitter's own `plugin/query_predicates.lua` has
-- registered its (broken) version, or that clobbers this one right back.
-- `LazyDone` fires once after all plugins (incl. nvim-treesitter's own
-- plugin/ scripts) have finished loading, so it's the reliable hook.
vim.api.nvim_create_autocmd("User", {
pattern = "LazyDone",
once = true,
callback = function()
M.patch_mimetype_directive()
end,
})
function M.patch_mimetype_directive()
local html_script_type_languages = {
["importmap"] = "json",
["module"] = "javascript",
["application/ecmascript"] = "javascript",
["text/ecmascript"] = "javascript",
}
vim.treesitter.query.add_directive("set-lang-from-mimetype!", function(match, _, bufnr, pred, metadata)
local nodes = match[pred[2]]
local node = nodes and nodes[1]
if not node then
return
end
local type_attr_value = vim.treesitter.get_node_text(node, bufnr)
local configured = html_script_type_languages[type_attr_value]
if configured then
metadata["injection.language"] = configured
else
local parts = vim.split(type_attr_value, "/", {})
metadata["injection.language"] = parts[#parts]
end
end, { force = true })
end
M.treesitter_config_setup = {
-- Add languages to be installed here that you want installed for treesitter
ensure_installed = {
"bash", "c", "cpp", "go", "lua", "python", "rust",
"tsx", "javascript", "typescript", "vimdoc", "vim",
"ruby", "html", "embedded_template",
},
auto_install = true,