Created
March 14, 2023 02:11
-
-
Save alex-courtis/f82c6004b1ef64b8b778ef90e73aac07 to your computer and use it in GitHub Desktop.
nvim: event logging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function bi(event, data) | |
log.line( | |
"dev", | |
"%15.15s buftype=%s filetype=%s bufhidden=%s swapfile=%s modifiable=%s buflisted=%s winnr=%d winid=%d tabpage=%d %d %s", | |
event, | |
vim.api.nvim_buf_get_option(data.buf, "buftype"), | |
vim.api.nvim_buf_get_option(data.buf, "filetype"), | |
vim.api.nvim_buf_get_option(data.buf, "bufhidden"), | |
vim.api.nvim_buf_get_option(data.buf, "swapfile"), | |
vim.api.nvim_buf_get_option(data.buf, "modifiable"), | |
vim.api.nvim_buf_get_option(data.buf, "buflisted"), | |
vim.fn.bufwinnr(data.buf), | |
vim.fn.bufwinid(data.buf), | |
vim.api.nvim_win_get_tabpage(vim.fn.bufwinid(data.buf)), | |
data.buf, | |
vim.api.nvim_buf_get_name(data.buf) | |
) | |
end | |
create_nvim_tree_autocmd("BufEnter", { | |
callback = function(data) | |
bi("BufEnter", data) | |
end, | |
}) | |
create_nvim_tree_autocmd("SessionLoadPost", { | |
callback = function(data) | |
bi("SessionLoadPost", data) | |
end, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment