This commit is contained in:
RingOfStorms (Joshua Bell) 2024-04-30 11:02:30 -05:00
parent c72d894bbd
commit 0b833d555c
13 changed files with 719 additions and 46 deletions

13
lua/tools/init.lua Normal file
View file

@ -0,0 +1,13 @@
-- Require all files in this tools dir, minus this init.lua file
function script_path()
return debug.getinfo(2, "S").source:sub(2):match("(.*/)")
end
-- Extract the directory name from the script path
local directory_name = script_path():match(".*/(.*)/")
for _, file in ipairs(vim.fn.readdir(script_path(), [[v:val =~ '\.lua$']])) do
if file ~= "init.lua" then
local neighbor = string.sub(file, 0, -5)
require(directory_name .. "." .. neighbor)
end
end

20
lua/tools/quick-fix.lua Normal file
View file

@ -0,0 +1,20 @@
-- Function to remove item from quickfix list
function RemoveQFItem()
local curqfidx = vim.fn.line(".") - 1
local qfall = vim.fn.getqflist()
table.remove(qfall, curqfidx + 1) -- Lua is 1-indexed
vim.fn.setqflist(qfall, "r")
vim.cmd(curqfidx .. "cfirst")
vim.cmd("copen")
end
-- Command to call the function
vim.api.nvim_create_user_command("RemoveQFItem", RemoveQFItem, {})
-- Auto command to map 'dd' in quickfix window
vim.api.nvim_create_autocmd("FileType", {
pattern = "qf",
callback = function()
vim.keymap.set("n", "dd", RemoveQFItem, { buffer = true, silent = true })
end,
})