quick fix helpers
This commit is contained in:
parent
30e0d50e45
commit
d13a904c3f
1 changed files with 20 additions and 0 deletions
20
lua/tools/quick-fix.lua
Normal file
20
lua/tools/quick-fix.lua
Normal 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,
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue