-
Notifications
You must be signed in to change notification settings - Fork 59
✨ Feature: API to enable for specific buffer/win? #216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
On the local cmd = require("markview").commands;
-- Attach to a buffer.
cmd.attach(1);
-- Detach from a buffer.
cmd.detach(1);
-- Draw preview to a buffer(this will not change `conceallevel` & `concealcursor`, and will not update itself).
cmd.redraw(1);
-- Clear previews from a buffer.
cmd.clear(1); These can also be used as regular commands. :Markview attach 1
:Markview detach 1
:Markview redraw 1
:Markview clear 1 |
It unfortunately doesn't allow passing a window as the renderers don't care about the window Rather they run a utility function to get the most likely correct window. |
Shouldn’t make a difference as the preview buffer is “unique”, I’ll test this tomorrow and let you know. |
@OXY2DEV, this was completed in ibhagwan/fzf-lua@ed6539e. Unfortuntaely, it's a bit laggy, when scrolling it's also not very funcitonal, as it's very slow and almost impossible to cancel, for example, if I press scroll 5 times I have to wait a while for the result to be displayed and the intreface is laggy while this happens. Let me know if there's a better way than calling |
That's weird. It shouldn't be lagging when scrolling.
Do you have anything that modifies the buffers text? The default denounce value is 50ms which is noticable in most cases so it could be just the plugin waiting for the denounce period to finish. Can you tell me how
The reason there's not method for that is because the I will add a method to check it. |
Nothing special, scroll is just a call to ctrl-d/u.
Markview is enabled by default, use the latest fzf-lua and have markview plugin loaded and it should get called automatically in the preview buffer. |
Uhh, so how do I scroll? I can't use |
Change the bindings to something you can use. For a single call picker call: :lua require("fzf-lua").files({keymap={builtin={["<c-f>"]="preview-page-down"}}}) Permanently: require("fzf-lua").setup({
keymap = {
builtin = {
true, -- inherit other default binds
-- Also try preview-half-page-{up|down}
["<c-f>"]="preview-page-down",
["<c-b>"]="preview-page-up"
}
}
}) |
Ah, thanks. That works. I am noticing lags when switching between files. But I don't see any lags when doing Does the lag happen even when viewing small files on your end? |
Happens on the fzf-lua project REAME.md, let me know if you’d like I’ll record a comparison between how it behaves with render-markdown vs markview. |
So, I am noticing that on each scroll
I don't think you need to run You can however do.
You are running it on each scroll. So, this should be a lot simpler and easier. |
Yup, it's definitely the 2 redraws. I changed But this means that Since |
Changed to: cmd.clear(bufnr);
cmd.redraw(bufnr); Similar slow and laggy behavior on scrolls. |
It seems this is still rendered regardless of the options (I didn't check if it's set or not), but if these are needed and I call |
Uhh, does it look like this on your end? I can't really tell which one(Termux, neovim, fzf-lua or markdown) is lagging. Screenrecorder-2024-12-06-08-53-04-455.mp4 |
Yes, because I don't actually set any options. I just run a function(that can be defined by the user too) when previews are enabled. But I guess it makes sense to also call them on Also, I am seeing that you have pushed changes to Unfortunately, the whole So, I think you should comment it out until |
I see, perhaps it's better off I will comment this out as well and we do the testing again once this is on the main branch, otherwise it's just asking for issues. |
Can you send a recording of the lags? |
Recoding now, I found the issue is actually much worse, just having markview enabled makes the scroll of anything in fzf-lua worse, even when markview rendering is disabled in the previewer, recording now. |
I think I found the issue. For some reason, I added This caused the plugin to become extremely laggy since every time |
I just recorded using software called Basically if I hold down
It certainly does feel like markview is doing something regardless of it happening in an unattached buffer. |
I have done some test. And the lag is definitely coming from the movement autocmds. I will see where the issue is. |
I have made some changes to how redrawing works. Can you test it out(as I can't test it properly on a phone)? Here's a minimal config to make it easier, vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
require("lazy.minit").repro({
spec = {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
ensure_installed = { "markdown", "markdown_inline" }
},
{
"OXY2DEV/markview.nvim",
branch = "dev",
lazy = false
},
{
"ibhagwan/fzf-lua",
commit = "ed6539e018a522f176ad1f1ee6cb2e0172e8379a",
pin = true,
opts = {
keymap = {
builtin = {
["<PageUp>"] = "preview-page-up",
["<PageDown>"] = "preview-page-down",
}
}
}
}
},
});
vim.o.conceallevel = 3;
vim.api.nvim_set_keymap("n", "<space>q", "<CMD>:q<CR>", {}); |
Going to sleep, will test tomorrow, now regarding this part…
Is this a temporary a thing or are you telling me you’ve developed this plugin in its entirety on a freaking phone, and why do I get the feeling it’s the latter (as evident in this comment)? 🤯🤯🤯 If so, I gotta step up my game, this is some next level dedication lol |
Those 4k+ stars(in your repos) would like to disagree with you. |
Couldn’t help it lol https://www.reddit.com/r/neovim/comments/1h7vhmg/bro_been_developing_his_2k_star_plugin_on_a/
You’re too kind :) |
So, I have looked into the issue a bit more and here's what I found,
Here's what I think should be done. Allow |
Allows buffers to show previews even if previews are disabled for that mode. Ref: #216
Here's a simple comparison(with the minimal config, Pay attention to when I let go of the buttons.
before.mp4
after.mp4Note I deleted |
Can def see the difference.
Just making sure I understand this right,I should reduce calls to |
Yes, just calling Let me know, if the lag still occurs. |
It's fantastic now, no lag! While adding support for render-markdown I realized I could minic the split view (which you have added to this plugin), looks quite wonderful doesn't it? We can close this issue with this beautiful screenshot, cheers @OXY2DEV 🚀 |
Awesome!
Indeed, it does. Even though I added So, feedbacks are welcome.
Cheers! |
Just re-enabled support for elseif package.loaded["markview"] then
local cmds = package.loaded["markview"].commands
if cmds and cmds.redraw then cmds.attach(bufnr, true) end
end |
Yes, this looks good. |
I don't have a PC to code on. |
If you're interested, there are some people in https://www.reddit.com/r/neovim/comments/1h7vhmg/bro_been_developing_his_2k_star_plugin_on_a/ who are interested in starting a GoFundMe for you to get a laptop! |
There's already #218 about that. GoFundMe only works on selected countries, so it wouldn't really work out. |
What country are you in? I might be able to help coordinate. I run https://hackclub.com which has given grants to high schoolers all over the world. |
Bangladesh.
I am not a high schooler though(unless high school also includes the 11th & 12th grade). |
@OXY2DEV you should be able to setup buymecoffee or ko-fi at least 🤔 |
@OXY2DEV if you can cash it out, I (and surely other people as well) could also send you some crypto currencies! I'd be happy to send you some Bitcoin or Monero :) |
Although cryptocurrencies are convenient for international transactions, I don’t think there is a way for a minor to cash out for fiat currency. |
It is good idea. He has parents that can cash out or he can wait until he is no longer minor. I can also send xrp. |
Allows buffers to show previews even if previews are disabled for that mode. Ref: #216
The nature of the feature:
Description:
Hi again @OXY2DEV!
Would love to support your amazing plugin in fzf-lua previews, similar to what I did with
render-markdown.nvim
ibhagwan/fzf-lua#1546.Is there a single command I can run, similar to what is described here:
Where I'm able to attach to a specific window/buffer and trigger a redraw (so that I can call it upon scroll/resize/etc) that does not rely on autocmds (those are limited/ignored in the preview buffer)?
The text was updated successfully, but these errors were encountered: