From a25ca205ca5755b2947b49983a0d97daa4edac08 Mon Sep 17 00:00:00 2001 From: Squibid Date: Tue, 16 Dec 2025 17:27:51 -0500 Subject: [PATCH] zig and some qf silliness --- after/ftplugin/qf.lua | 6 ++++++ lua/conf/binds.lua | 29 +++++++++++++++++++++++++++++ lua/conf/plugins/treesitter.lua | 11 +---------- lua/snippets/zig.lua | 10 ++++++++++ 4 files changed, 46 insertions(+), 10 deletions(-) create mode 100644 after/ftplugin/qf.lua create mode 100644 lua/snippets/zig.lua diff --git a/after/ftplugin/qf.lua b/after/ftplugin/qf.lua new file mode 100644 index 0000000..23db842 --- /dev/null +++ b/after/ftplugin/qf.lua @@ -0,0 +1,6 @@ +core.misc.map_local("n", "dd", function () + local qf = vim.fn.getqflist() + local idx = vim.fn.getqflist({ idx = vim.api.nvim_win_get_cursor(0)[1] }).idx + table.remove(qf, idx) + vim.fn.setqflist(qf, 'r') +end) diff --git a/lua/conf/binds.lua b/lua/conf/binds.lua index 89eaa47..b00a375 100644 --- a/lua/conf/binds.lua +++ b/lua/conf/binds.lua @@ -74,3 +74,32 @@ map("c", "", function() feedkeys("") end) -- execute line/block map("n", "x", ":.lua") map("x", "x", ":lua") + +-- 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", "qt", show_trace_list) +map("n", "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) diff --git a/lua/conf/plugins/treesitter.lua b/lua/conf/plugins/treesitter.lua index f3d6efb..fbe620c 100644 --- a/lua/conf/plugins/treesitter.lua +++ b/lua/conf/plugins/treesitter.lua @@ -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", "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 - } } diff --git a/lua/snippets/zig.lua b/lua/snippets/zig.lua new file mode 100644 index 0000000..c0bc681 --- /dev/null +++ b/lua/snippets/zig.lua @@ -0,0 +1,10 @@ +dofile(core.snippets) + +return { + -- function snippet + s("this", { + t("const "), + f(file_name, {}), + t(" = @This();"), + }), +}