Skip to content

Document buffer and expr fields in KeySpec API#9

Draft
Copilot wants to merge 5 commits into
masterfrom
copilot/update-documentation-for-new-fields
Draft

Document buffer and expr fields in KeySpec API#9
Copilot wants to merge 5 commits into
masterfrom
copilot/update-documentation-for-new-fields

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 13, 2026

Two fields (buffer and expr) were added to the KeySpec API in recent commits but lacked documentation.

Changes

  • KeySpec API table: Added buffer and expr field specifications with defaults and descriptions
  • Expression Mappings section: Documented expr behavior—clarified that maplayer feeds keys via feedkeys() rather than returning them to Vim's expression evaluator
  • Buffer-Local Mappings section: Documented buffer field with examples for direct usage (buffer = true) and dynamic application pattern (make() + autocmd)
  • Anchor links: Fixed broken references in API table to newly reorganized sections
  • Table formatting: Corrected malformed pipe separators in Chinese README

Example Usage

-- Buffer-local mapping applied to current buffer
require('maplayer').setup({
  {
    key = '<CR>',
    mode = 'n',
    buffer = true,  -- New field
    desc = 'Follow link',
    handler = function()
      vim.cmd('normal! gx')
      return true
    end,
  },
})

-- Expression mapping with feedkeys behavior
require('maplayer').setup({
  {
    key = '<CR>',
    mode = 'i',
    expr = true,  -- New field
    desc = 'Smart enter',
    handler = function()
      return vim.fn.pumvisible() == 1 and '<C-y>' or '<CR>'
    end,
  },
})

Both English and Chinese documentation updated.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits February 13, 2026 03:56
Co-authored-by: Kaiser-Yang <58209855+Kaiser-Yang@users.noreply.github.com>
Co-authored-by: Kaiser-Yang <58209855+Kaiser-Yang@users.noreply.github.com>
Co-authored-by: Kaiser-Yang <58209855+Kaiser-Yang@users.noreply.github.com>
Co-authored-by: Kaiser-Yang <58209855+Kaiser-Yang@users.noreply.github.com>
Copilot AI changed the title [WIP] Update documentation to reflect new fields and examples Document buffer and expr fields in KeySpec API Feb 13, 2026
Copilot AI requested a review from Kaiser-Yang February 13, 2026 04:01
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.

2 participants