zig and some qf silliness

This commit is contained in:
Squibid 2025-12-16 17:27:51 -05:00
parent 3d9a24ced8
commit a25ca205ca
Signed by: squibid
GPG key ID: BECE5684D3C4005D
4 changed files with 46 additions and 10 deletions

View file

@ -74,3 +74,32 @@ map("c", "<C-d>", function() feedkeys("<Del>") end)
-- execute line/block
map("n", "<leader>x", ":.lua<CR>")
map("x", "<leader>x", ":lua<CR>")
-- qf madness
local trace_list = { data = {} }
trace_list.meta = {
title = "Trace List",
items = trace_list.data
}
local function show_trace_list()
vim.fn.setqflist({}, " ", trace_list.meta)
end
map("n", "<leader>qt", show_trace_list)
map("n", "<leader>qg", function()
local new
if vim.bo[0].ft ~= "qf" then
new = {
filename = vim.fn.expand("%:p"),
lnum = vim.fn.line("."),
col = vim.fn.col("."),
text = vim.fn.getline("."),
}
else
new = vim.fn.getqflist()[vim.api.nvim_win_get_cursor(0)[1]]
end
trace_list.data[#trace_list.data + 1] = new
if vim.fn.getqflist({ title = 1 }).title == trace_list.meta.title then
show_trace_list()
end
end)

View file

@ -10,7 +10,7 @@ return {
-- good default parsers
ensure_installed = { "c", "lua", "vim", "vimdoc", "markdown",
"markdown_inline", "java", "bash", "css", "html", "luadoc",
"make"
"make", "zig"
},
-- indentation
@ -74,13 +74,4 @@ return {
map("n", "<leader>j", require("treesj").toggle, { desc = "fold code" })
end
},
{ "windwp/nvim-ts-autotag",
reqs = "nvim-treesitter/nvim-treesitter",
disable = true,
-- lazy = dep_short.auto({ "BufReadPre", "BufNewFile" }),
load = function()
require("nvim-ts-autotag").setup {}
end
}
}

10
lua/snippets/zig.lua Normal file
View file

@ -0,0 +1,10 @@
dofile(core.snippets)
return {
-- function snippet
s("this", {
t("const "),
f(file_name, {}),
t(" = @This();"),
}),
}