Skip to content

Instantly share code, notes, and snippets.

@alex-courtis
Created March 14, 2023 02:11
Show Gist options
  • Save alex-courtis/f82c6004b1ef64b8b778ef90e73aac07 to your computer and use it in GitHub Desktop.
Save alex-courtis/f82c6004b1ef64b8b778ef90e73aac07 to your computer and use it in GitHub Desktop.
nvim: event logging
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