Autocmds
Blak registers a small set of autocmds across the runtime. Each one lives in a named augroup so it can be cleared without affecting others.
Source: lua/blak/core/autocmds.lua plus a few inline in other modules.
Core (BlakCore group)
Section titled “Core (BlakCore group)”TextYankPost — flash on yank
Section titled “TextYankPost — flash on yank”Highlights the yanked region for 180 ms so you see exactly what was captured.
vim.api.nvim_create_autocmd("TextYankPost", { callback = function() vim.highlight.on_yank({ timeout = 180 }) end,})VimResized — equalize splits
Section titled “VimResized — equalize splits”When the terminal resizes, re-equalize all windows so panes don’t stay lopsided.
BufReadPost — restore cursor
Section titled “BufReadPost — restore cursor”After opening the current editing buffer, jump to its last known position. Background reads and special buffers do not move the visible cursor.
FileType — close on q
Section titled “FileType — close on q”For help, qf, man, checkhealth, lspinfo, notify: unlist the buffer and bind q to close it.
Splash (BlakSplash group)
Section titled “Splash (BlakSplash group)”User SnacksDashboardOpened / SnacksDashboardUpdatePost
Section titled “User SnacksDashboardOpened / SnacksDashboardUpdatePost”Starts (or repaints) the black-hole animation on the dashboard buffer. See Splash.
Registered in lua/blak/splash/init.lua.
LSP (BlakLspKeys group)
Section titled “LSP (BlakLspKeys group)”LspAttach — bind LSP keymaps
Section titled “LspAttach — bind LSP keymaps”When a server attaches to a buffer, bind the buffer-local LSP keymaps (gd, gD, gI, gr, K, <leader>ca, <leader>cr, <leader>cs, <leader>cS, <leader>cf).
Registered in lua/blak/core/keymaps.lua.
Update (BlakUpdate group)
Section titled “Update (BlakUpdate group)”User LazyUpdatePre — snapshot rollback state
Section titled “User LazyUpdatePre — snapshot rollback state”Before any :Lazy update, write a rollback snapshot under stdpath('state')/blak/rollbacks/. The snapshot includes lazy-lock.json, lua/blak/user.lua, enabled extras state, upgrade migration state, and accepted update state. This means even a manual :Lazy update is protected.
Registered in lua/blak/core/update.lua.
Treesitter
Section titled “Treesitter”FileType — start treesitter
Section titled “FileType — start treesitter”Lazy-attaches treesitter to a buffer if the buffer’s line count is under performance.max_treesitter_lines. Also sets indentexpr to nvim-treesitter’s indent.
Registered in lua/blak/core/treesitter.lua.
User events emitted by Blak
Section titled “User events emitted by Blak”| Event | When | Where |
|---|---|---|
User BlakReady |
After core setup and plugin registration; lazy plugins load later. | lua/blak/init.lua |
See User events for how to hook them.
Augroup discipline
Section titled “Augroup discipline”Every Blak group is created with clear = true so re-sourcing the config doesn’t double-register handlers:
vim.api.nvim_create_augroup("BlakCore", { clear = true })If you write your own integrations against Blak, do the same.