Skip to content

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.

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,
})

When the terminal resizes, re-equalize all windows so panes don’t stay lopsided.

After opening the current editing buffer, jump to its last known position. Background reads and special buffers do not move the visible cursor.

For help, qf, man, checkhealth, lspinfo, notify: unlist the buffer and bind q to close it.

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.

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.

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.

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.

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.

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.