zig and some qf silliness
This commit is contained in:
parent
3d9a24ced8
commit
a25ca205ca
4 changed files with 46 additions and 10 deletions
6
after/ftplugin/qf.lua
Normal file
6
after/ftplugin/qf.lua
Normal file
|
|
@ -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)
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
10
lua/snippets/zig.lua
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
dofile(core.snippets)
|
||||
|
||||
return {
|
||||
-- function snippet
|
||||
s("this", {
|
||||
t("const "),
|
||||
f(file_name, {}),
|
||||
t(" = @This();"),
|
||||
}),
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue