diff --git a/README.md b/README.md index b4afb8e..7358f7b 100644 --- a/README.md +++ b/README.md @@ -312,12 +312,25 @@ require('auto-session').setup { end }, + -- Save quickfix list and open it when restoring the session save_extra_cmds = { function() - return [[echo "hello world"]] - end - } -} + local qflist = vim.fn.getqflist() + -- return nil to clear any old qflist + if #qflist == 0 then return nil end + local qfinfo = vim.fn.getqflist({ title = 1 }) + + for _, entry in ipairs(qflist) do + -- use filename instead of bufnr so it can be reloaded + entry.filename = vim.api.nvim_buf_get_name(entry.bufnr) + entry.bufnr = nil + end + + local setqflist = 'call setqflist(' .. vim.fn.string(qflist) .. ')' + local setqfinfo = 'call setqflist([], "a", ' .. vim.fn.string(qfinfo) .. ')' + return { setqflist, setqfinfo, 'copen' } + end, + }, ``` ## ➖ Statusline