neovim

Personal neovim configuration files
git clone git://gtms.dev/neovim
Log | Files | Refs

qf.lua (843B)


      1 local function decide(item, templates, other)
      2   local data = item.user_data
      3   if not data then
      4     table.insert(other, item)
      5     return
      6   end
      7 
      8   local uri = data.uri
      9   if not uri then
     10     table.insert(other, item)
     11     return
     12   end
     13 
     14   if string.match(uri, ".template.dart") then
     15     table.insert(templates, item)
     16   else
     17     table.insert(other, item)
     18   end
     19 end
     20 
     21 -- TODO(tms) 21.02.25: Make it filter local and external by uri
     22 vim.keymap.set('n', '<leader>at', function()
     23   local items = vim.fn.getqflist()
     24   local templates = {}
     25   local other = {}
     26 
     27   for _, item in ipairs(items) do
     28     decide(item, templates, other)
     29   end
     30 
     31   vim.fn.setqflist({}, 'r', { title = "Templates", items = templates })
     32   vim.fn.setqflist({}, ' ', { title = "References", items = other })
     33 end, { buffer = true, desc = 'Quickfix Split Template Files', nowait = true })