-
Notifications
You must be signed in to change notification settings - Fork 11
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
feat: paste window open hook #197
Comments
Hey @ofseed thanks for reporting. Regarding adjusting window options, there are overrides exposed via:
There is an example of this in Advanced Configuration Examples named ksb_example_paste_win_winopts. But, I agree, there is no general hook if you want to do something based on the |
I know this option, and I fixed a bug about this : ), see: #182 There's a more complicated situation in my use case. I'm using |
😅 oops, didn't realize.
Ah, I see yeah you are right. |
# [4.2.0](v4.1.0...v4.2.0) (2024-02-20) ### Bug Fixes * add buffer name suffix .ksb_footerbuf to footer ([4f234de](4f234de)) * create separate set_local_defaults function ([2c6812a](2c6812a)) * include buffer local mappings when resolving footer keymaps ([af2aa25](af2aa25)) ### Features * add after_paste_window_ready callback ([646a41e](646a41e)), closes [#197](#197)
🎉 This issue has been resolved in version 4.2.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Hey @ofseed I added the callback local paste_window_data = {
scrollback_buffer = { bufid = p.bufid, winid = p.winid },
paste_window = { bufid = p.paste_bufid, winid = p.paste_winid },
paste_window_footer = { bufid = p.footer_bufid, winid = p.footer_winid },
} I played around a bit and created this example: require('kitty-scrollback').setup({
{
callbacks = {
after_paste_window_ready = function(pastewin_data, kitty_data, opts)
local stc = '%#ErrorMsg#%{(v:lnum%2)?" ".v:lnum:""}' .. '%#WarningMsg#%{!(v:lnum%2)?" ".v:lnum:""} '
vim.api.nvim_set_option_value('statuscolumn', stc, {
win = pastewin_data.paste_window.winid,
})
vim.keymap.set({ '' }, '<Tab>', '<Plug>(KsbToggleFooter)', {
buffer = pastewin_data.paste_window.bufid,
})
if pastewin_data.paste_window_footer.winid then
vim.api.nvim_set_option_value('statuscolumn', 'help:', {
win = pastewin_data.paste_window_footer.winid,
})
end
end,
},
},
}) Please let me know if you run into any issues |
It runs without problems, thank you! |
Because the paste window needs a common filetype like
bash
to get the correct syntax highlighting and completion, It's hard to do something like setting keymaps or adjusting window options. I suggest exposing a hook function that receiveswinid
orbufnr
as arguments for doing these things.The text was updated successfully, but these errors were encountered: