I am trying to delete items from the quickfix list, using the same delete interface I am used to, visual delete and dd. The .vimrc code I am trying to use to accomplish this is below. It does not work. It skips every other line and moves the cursor several lines down probably related to how many lines were visually selected. dd works but visual selected is where it breaks down.
function! Delete()
if &buftype == 'quickfix'
call setqflist(filter(getqflist(), {idx -> idx != line('.') - 1}), 'r')
else
deletel
endif
endfunction
nnoremap <silent> dd :call Delete()<cr>
vnoremap <silent> d :call Delete()<cr>