stevearc / quicker.nvim

Improved UI and workflow for the Neovim quickfix
MIT License
325 stars 3 forks source link

feature request: allow undo to before saved changes #27

Open ibrokemypie opened 4 weeks ago

ibrokemypie commented 4 weeks ago

Neovim version (nvim -v)

v0.10.1

Operating system/version

NixOS 24.11 (Vicuna)

Describe the bug

After saving changes to the quickfix buffer, the undo history is lost, and hitting u says that I am already at the oldest change. Before saving the changes undo works as expected.

What is the severity of this bug?

tolerable (can work around it)

Steps To Reproduce

  1. :grep file
  2. :%s/ file/ folder/
  3. :w
  4. u

Expected Behavior

All instances of file that were replaced with folder are reverted back the way they were in the quickfix buffer. The buffer is marked as modified. The actual contents of the files that were changed when saving the quickfix buffer are so far unmodified, but saving the buffer now would return them back the way they were before running the replacement.

Minimal example file

one file
two file
three file
four file

Minimal init.lua

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  {
    "stevearc/quicker.nvim",
    config = function()
      require("quicker").setup({
        -- add your config here
      })
    end,
  },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

Additional context

No response

stevearc commented 2 weeks ago

This is an intentional gap at the moment. Saving the quickfix buffer actually calls setqflist which will generate an entirely new quickfix buffer. There may be a way to keep the history, but it will require a pile of hacks.