summaryrefslogtreecommitdiffstatshomepage
path: root/runtime/lua/vim/keymap.lua
AgeCommit message (Collapse)AuthorFiles
2026-03-23fix(lua): drop support for boolean `buf` in `vim.keymap` #38432skewb1k1
Problem: `vim.keymap.*.Opts.buf` allows `boolean` aliases for more widely used `integer?` values, `true` -> `0` and `false` -> `nil`. This conversion is unnecessary and can be handled at call sites. Solution: As a follow-up to deprecating the `buffer` option, drop support for boolean values for the new `buf` option. The deprecated `buffer` continues to support booleans for backward compatibility.
2026-03-21feat(lua): replace `buffer` with `buf` in vim.keymap.set/del #38360skewb1k1
The `buffer` option remains functional but is now undocumented. Providing both will raise an error. Since providing `buf` was disallowed before, there is no code that will break due to using `buffer` alongside `buf`.
2026-02-05docs(lua): vim.keymap.set takes no `noremap` #37723Christian Clason1
Problem: Unlike `nvim_keymap_set`, `vim.keymap.set` uses the non-negated `remap` instead of `:set`'s `noremap`, but the documentation for this got lost sometime before Nvim 0.10. Solution: Restore the lost documentation and make it more explicit.
2025-12-20docs(lua): iInconsistent vim.keymap param name #37026Bryan Turns1
Problem: vim.keymap.del has 'modes' as it's first argument while vim.keymap.set has 'mode' as it's first argument despite both 'mode' and 'modes' taking in the same type input of String or String[]. Solution: Updated vim.keymap.set docs to refer to it's first argument as 'modes'.
2025-11-15docs: getpos, getregion, lspJustin M. Keyes1
2025-07-10docs: api, pack, events, developJustin M. Keyes1
2024-10-21feat(vim.validate): improve fast form and deprecate spec formLewis Russell1
Problem: `vim.validate()` takes two forms when it only needs one. Solution: - Teach the fast form all the features of the spec form. - Deprecate the spec form. - General optimizations for both forms. - Add a `message` argument which can be used alongside or in place of the `optional` argument.
2024-09-25refactor(lua): vim.keymap.set tests, docs #30511Justin M. Keyes1
2024-03-16refactor(lua): type annotationsLewis Russell1
2024-02-27feat(docs): replace lua2dox.luaLewis Russell1
Problem: The documentation flow (`gen_vimdoc.py`) has several issues: - it's not very versatile - depends on doxygen - doesn't work well with Lua code as it requires an awkward filter script to convert it into pseudo-C. - The intermediate XML files and filters makes it too much like a rube goldberg machine. Solution: Re-implement the flow using Lua, LPEG and treesitter. - `gen_vimdoc.py` is now replaced with `gen_vimdoc.lua` and replicates a portion of the logic. - `lua2dox.lua` is gone! - No more XML files. - Doxygen is now longer used and instead we now use: - LPEG for comment parsing (see `scripts/luacats_grammar.lua` and `scripts/cdoc_grammar.lua`). - LPEG for C parsing (see `scripts/cdoc_parser.lua`) - Lua patterns for Lua parsing (see `scripts/luacats_parser.lua`). - Treesitter for Markdown parsing (see `scripts/text_utils.lua`). - The generated `runtime/doc/*.mpack` files have been removed. - `scripts/gen_eval_files.lua` now instead uses `scripts/cdoc_parser.lua` directly. - Text wrapping is implemented in `scripts/text_utils.lua` and appears to produce more consistent results (the main contributer to the diff of this change).
2024-01-03feat(lua): add noref to deepcopyLewis Russell1
Problem: Currently `deepcopy` hashes every single tables it copies so it can be reused. For tables of mostly unique items that are non recursive, this hashing is unnecessarily expensive Solution: Port the `noref` argument from Vimscripts `deepcopy()`. The below benchmark demonstrates the results for two extreme cases of tables of different sizes. One table that uses the same table lots of times and one with all unique tables. | test | `noref=false` (ms) | `noref=true` (ms) | | -------------------- | ------------------ | ----------------- | | unique tables (50) | 6.59 | 2.62 | | shared tables (50) | 3.24 | 6.40 | | unique tables (2000) | 23381.48 | 2884.53 | | shared tables (2000) | 3505.54 | 14038.80 | The results are basically the inverse of each other where `noref` is much more performance on tables with unique fields, and `not noref` is more performant on tables that reuse fields.
2023-09-23docs: fix type warningsMaria José Solano1
2023-09-14docs: replace <pre> with ``` (#25136)Gregory Anders1
2023-07-13docs(lua): adds links to related keymap functions to keymap.set (#24337)Mathias Fußenegger1
Might help with discovery, given that there is no `keymap.get()`
2023-06-12docs: various clarifications (#23999)zeertzjq1
Close #18907 Close #20314 Close #23749
2023-06-10docs: fix typos (#23917)Jonas Strittmatter1
2023-02-22docs: naming conventions, guidelinesJustin M. Keyes1
close #21063
2022-12-02docs(gen): support language annotation in docstringsChristian Clason1
2022-09-20docs(lua): opts in `vim.keymap.{set,del}` can be optional (#20255)Lewis Russell1
2022-08-14docs(lua): clarify vim.keymap.set() opts (#19761)Antoine Cotten1
2022-08-03docs: fix typos (#19588)dundargoc1
Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: notomo <notomo.motono@gmail.com>
2022-08-02test: improve mapping tests and docs (#19619)zeertzjq1
2022-08-01feat(api): add replace_keycodes to nvim_set_keymap (#19598)ii141
2022-05-09chore: format runtime with styluaChristian Clason1
2022-04-23fix(lua): don't mutate opts parameter of vim.keymap.del (#18227)Andrey Mishchenko1
`vim.keymap.del` takes an `opts` parameter that lets caller refer to and delete buffer-local mappings. For some reason the implementation of `vim.keymap.del` mutates the table that is passed in, setting `opts.buffer` to `nil`. This is wrong and also undocumented.
2022-04-21docs: vim.keymap.set can specify buffer as an optionatusy1
2022-04-01fix(keymap): don't coerce false to ''Lewis Russell1
2022-03-24feat(keymap): return nil from an expr keymapLewis Russell1
For Lua callback expr keymaps, returning `nil` or `false` is equivalent to an empty string
2022-03-17chore: fix typos (#17670)dundargoc1
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-03-10chore: fix typos (#17331)dundargoc1
Co-authored-by: Hongyi Lyu <hongyi.lyu95@gmail.com> Co-authored-by: Gregory Anders <greg@gpanders.com> Co-authored-by: notomo <notomo.motono@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-02-27chore: remove <Plug> detection from vim.keymapshadmansaleh1
2022-01-04feat(lua): add vim.keymapshadmansaleh1
This introduces two new functions `vim.keymap.set` & `vim.keymap.del` differences compared to regular set_keymap: - remap is used as opposite of noremap. By default it's true for <Plug> keymaps and false for others. - rhs can be lua function. - mode can be a list of modes. - replace_keycodes option for lua function expr maps. (Default: true) - handles buffer specific keymaps Examples: ```lua vim.keymap.set('n', 'asdf', function() print("real lua function") end) vim.keymap.set({'n', 'v'}, '<leader>lr', vim.lsp.buf.references, {buffer=true}) vim.keymap.set('n', '<leader>w', "<cmd>w<cr>", {silent = true, buffer = 5 }) vim.keymap.set('i', '<Tab>', function() return vim.fn.pumvisible() == 1 and "<C-n>" or "<Tab>" end, {expr = true}) vim.keymap.set('n', '[%', '<Plug>(MatchitNormalMultiBackward)') vim.keymap.del('n', 'asdf') vim.keymap.del({'n', 'i', 'v'}, '<leader>w', {buffer = 5 }) ```