Open Shatur opened 1 year ago
I added instructions here to enable baleia
for the quickfix window.
Also for some reason I don't heave the mentioned :BaleiaColorize from the README.md.
Have you created the command as instructed here?
Have you created the command as instructed here?
Oh, sorry, I misread and thought that the command is built-in. Yes, the created command works as expected.
I use this plugin https://github.com/stefandtw/quickfix-reflector.vim It makes the quickfix editable. And its compatible with other plugins since it just allow quickfix editing. And I put output to quickfix async. Is there a way to update my quickfix window (that works like a regular buffer) highlighting every time new line appears? I tried what you suggesting here, but in lua (see the first message).
It looks like changes to the buffer through quickfix API do not trigger on_bytes
events. I believe quickfix buffer use a custom "index" to control changes, that's why the events are not firing. The only reliable event is BufReadPost
so, if your qf is already modifiable, the following should work:
let s:baleia = luaeval("require('baleia').setup { }")
autocmd BufReadPost quickfix silent call g:baleia.once(bufnr('%'))
Tried it, but doesn't work, unfortunately. The same as with BufWinEnter
, the event is triggered only once. I probably could create a custom event when I output something to quickfix in my plugin. But is there a way to preprocess only the last line using baleia.nvim?
I don't use any qf plugin but what is on the README does colorize the buffer every time I execute :cexpr ...
But is there a way to preprocess only the last line using baleia.nvim?
if you figure a custom event you could use baleia's developer API to overwrite specific lines - or you can make your plugin write to the buffer using baleia's API
I don't use any qf plugin but what is on the README does colorize the buffer every time I execute :cexpr ...
Makes sense then. My use case I little bit different. I have a plugin that executes a task and puts the output to quickfix asynchronously. So I need to update the colorization every time a new line is available.
if you figure a custom event you could use baleia's developer API to overwrite specific lines - or you can make your plugin write to the buffer using baleia's API
In order to set quickfix data I have to use vim.fn.setqflist
, I can't use vim.api.nvim_buf_set_lines
. My qf is editable, but the tasks plugin doesn't know if the user have it writable. I could provide an autocmd when I set the quickfix, but looks like I can highlight the latest line.
There is a similar plugin for colors https://github.com/brenoprata10/nvim-highlight-colors. It works automatically, but doesn't support ANSI escape sequences. Is there any chance to have a similar API? I.e. Just apply the plugin to a buffer and it will track for the changes. Or is there a way to do it with the current API?
My qf is editable, but the tasks plugin doesn't know if the user have it writable
I don't understand this. Qf, by default, is nomodifiable
; have you changed that to modifiable
?
There is a similar plugin for colors https://github.com/brenoprata10/nvim-highlight-colors. It works automatically, but doesn't support ANSI escape sequences.
You could use the same events as the mentioned plugin to call baleia.once(..)
or you could simply call it every time you do setqflist(...)
on your code. If the buffer is nomodifiable
you either change it to modifiable
or use the option to not strip the ANSI codes. Choosing the former might require you to create a conceal
regexp
Is there any chance to have a similar API?
I think it would be possible to provide a custom setqflist
as part of the developer API, but not the other commands that eval {expr}
I don't understand this. Qf, by default, is nomodifiable; have you changed that to modifiable?
I use a separate plugin that makes it modifiable and on save applies changes to all buffers. https://github.com/stefandtw/quickfix-reflector.vim But let's forget about it right now.
You could use the same events as the mentioned plugin to call baleia.once(..) or you could simply call it every time you do setqflist(...) on your code.
Sorry, I probably confuse you :(
Let me explain it a little bit more. I have a task manager plugin that runs tasks async. And it appends data to quickfix every time task program print something while running. I can call baleia.once(..)
every time I append a data to quickfix, but it will be slow since your plugin will have to re-scan the whole quickfix. And I can't use buf_set_lines
because it's for regular buffer.
So Ideal solution would be to have buf_set_lines
, but for quickfix.
Or alternatively use a mechanism similar to https://github.com/brenoprata10/nvim-highlight-colors that updates colors automatically. It works in quickfix windows for me without any additional setup.
I output program into quickfix. Here is how it looks: quickfix.txt And here is my setup:
When I open quickfix I i prints buffer index (because I put
print
to check if I created autocmd correctly), but there is not highlighting. Also for some reason I don't heave the mentioned:BaleiaColorize
from theREADME.md
.