Skip to content

refactor: typed autocmd/highlight wrappers (shino.autocmd, shino.highlight) - #16

Merged
hypatia-tile merged 4 commits into
mainfrom
refactor/autocmd-highlight-wrappers
Aug 4, 2026
Merged

refactor: typed autocmd/highlight wrappers (shino.autocmd, shino.highlight)#16
hypatia-tile merged 4 commits into
mainfrom
refactor/autocmd-highlight-wrappers

Conversation

@hypatia-tile

Copy link
Copy Markdown
Owner

What

Extend the shino.keymap pattern to two more raw-API surfaces, then migrate every call site (full migration, matching the keymap precedent).

New modules

  • lua/shino/autocmd.lua
    • autocmd(event, desc, opts)desc required (self-documenting); opts borrows vim.api.keyset.create_autocmd.
    • group(name) — cleared-augroup shorthand.
  • lua/shino/highlight.lua
    • set(name, val) — drops the 0 namespace; val borrows vim.api.keyset.highlight.
    • extend(name, base, val) — define a group by inheriting base and merging val (folds the get_hl + tbl_extend pattern).

Migrated sites

  • autocmd (5): autocmds.lua, lsp/init.lua (×2), vimtex.lua, copilot.lua (+ its CopilotAttach augroup). The BufEnter and LspAttach ones gained descriptions.
  • highlight (4): vim-options.lua (CursorLineNr), catppuccin.lua (TelescopeSelection, converted from a :highlight command string), copilot.lua (ComplHint/ComplHintMore via extend).

No raw nvim_create_autocmd/nvim_set_hl remain outside the wrapper modules. No behavior change.

Test

  • bin/check (headless startup): OK
  • Types via CI (vim.api.keyset.* gives LuaLS field completion).

🤖 Generated with Claude Code

hypatia-tile and others added 4 commits August 4, 2026 19:21
Mirror shino.keymap for two more raw-API surfaces:

- shino.autocmd: `autocmd(event, desc, opts)` forces a self-documenting
  desc; `group(name)` is a cleared-augroup shorthand. opts borrows
  vim.api.keyset.create_autocmd.
- shino.highlight: `set(name, val)` drops the `0` namespace boilerplate;
  `extend(name, base, val)` folds the get_hl + merge pattern. val borrows
  vim.api.keyset.highlight.

Callers migrate in following commits.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace raw nvim_create_autocmd/nvim_create_augroup calls with the typed
wrappers across autocmds.lua, lsp/init.lua, vimtex.lua, and copilot.lua.
Each now carries a required desc (the BufEnter and LspAttach ones were
previously undocumented).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace raw nvim_set_hl calls with the typed wrappers:

- vim-options CursorLineNr and the catppuccin TelescopeSelection highlight
  (converted from a `:highlight` command string) use hl.set.
- copilot's ComplHint/ComplHintMore use hl.extend, folding the
  get_hl + tbl_extend pattern.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add the two new typed wrappers to the Custom Modules section, alongside
shino.keymap.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@hypatia-tile
hypatia-tile merged commit b95d3d7 into main Aug 4, 2026
3 checks passed
@hypatia-tile
hypatia-tile deleted the refactor/autocmd-highlight-wrappers branch August 4, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant