is there an inverse of .save()
My workflow is creating a qf list (with telescope usually), then pressing <leader>r which triggers the .run method and (conveniently) opens the editable qf list (if it is not already opened).
Sometimes though, i figure that i want to exit the editable qf list (=replacer ft) without any changes by e.g. returning to normal mode and then just hitting e.g. q to return to the normal, unmodifiable qf list. Maybe a bit like the .cleanup method does, but without ending up with an empty qf list.
Is this possible or am i just using it wrong (as in "stupid workflow")?
I experience something similar sometimes: I do "Ctrl+o" and then find myself in an empty buffer. I don't know exactly what to do about it. I could change the plugin to create a new buffer instead of changing the qf buffer, but it will leave those qf buffers around. What's your use case? What are you looking to do?
I experience something similar sometimes: I do "Ctrl+o" and then find myself in an empty buffer. I don't know exactly what to do about it. I could change the plugin to create a new buffer instead of changing the qf buffer, but it will leave those qf buffers around. What's your use case? What are you looking to do?
My use case is dead simple: I activate the replacer, immediately change my mind and just want to get my quickfix window back (e.g., to do some more filtering first or removing lines from qf, before again switching to replacer mode and actually do something).
I've been thinking about this. I never edit qf windows, but some people might. The issue is that replacer.nvim destroys the qf window, and reverting those destructive changes will be messy. I thought that instead of destroying the qf, I could simply create a new buffer, and if you want your qf back, go back or delete the current buffer. What do you think?
I made a quick implementation if you can try it out: https://github.com/gabrielpoca/replacer.nvim/compare/gp-preserve-qf?expand=1
All of this would be configured, and I would add another configuration to delete the qf window when you're done with replacer.nvim
Sounds like a good solution. I‘ll check the PR and give you feedback as soon as possible.
I had a quick look and generally it works, but I litterally just switched to the branch, did a :Lazy sync and tried to activate/deactivate replacer and then re-visiting my (now still existing) quickfix list. So i'll have to do some more testing.
Good side-effect: Replacer works now without issues alongside bqf, too.
I tested a bit and i have a suggestion (maybe independent from this testing branch):
File 1.md:Text content
File 2.md:Text content
File 3.md:Text content
and then i activate replacer and edit the buffer to be:
File.md:Text content
File.md:Text content
File.md:Text content
I get first:
Error executing lua callback: ...ocal/share/nvim/lazy/replacer.nvim/lua/replacer/init.lua:115: File Fest.md already exists
stack traceback:
[C]: in function 'error'
...ocal/share/nvim/lazy/replacer.nvim/lua/replacer/init.lua:115: in function 'save'
...ocal/share/nvim/lazy/replacer.nvim/lua/replacer/init.lua:204: in function <...ocal/share/nvim/lazy/replacer.nvim/lua/replacer/init.lua:204>
and it results in having 1 of the three files changed to File.md while the other 2 remain the same (obviously).
and when i try it again i get:
Error executing lua callback: Vim:E484: Can't open file <empty>
stack traceback:
[C]: in function 'readfile'
...ocal/share/nvim/lazy/replacer.nvim/lua/replacer/init.lua:53: in function 'save'
...ocal/share/nvim/lazy/replacer.nvim/lua/replacer/init.lua:204: in function <...ocal/share/nvim/lazy/replacer.nvim/lua/replacer/init.lua:204>
Maybe this kind of errors can be catched by some nice error handling? I think it is totally okay to produce this error in e.g., a heavy refactoring but it's hard to know what's going on, because of the cognitive load of lua tracebacks.
I had a quick look and generally it works, but I litterally just switched to the branch, did a
:Lazy syncand tried to activate/deactivate replacer and then re-visiting my (now still existing) quickfix list. So i'll have to do some more testing.Good side-effect: Replacer works now without issues alongside bqf, too.
I did some more testing and for me it works just fine now :)