aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/keymap.lua
Commit message (Collapse)AuthorAge
* feat(vim.validate): improve fast form and deprecate spec formLewis Russell2024-10-21
| | | | | | | | | | | | | | 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.
* refactor(lua): vim.keymap.set tests, docs #30511Justin M. Keyes2024-09-25
|
* refactor(lua): type annotationsLewis Russell2024-03-16
|
* feat(docs): replace lua2dox.luaLewis Russell2024-02-27
| | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* feat(lua): add noref to deepcopyLewis Russell2024-01-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* docs: fix type warningsMaria José Solano2023-09-23
|
* docs: replace <pre> with ``` (#25136)Gregory Anders2023-09-14
|
* docs(lua): adds links to related keymap functions to keymap.set (#24337)Mathias Fußenegger2023-07-13
| | | Might help with discovery, given that there is no `keymap.get()`
* docs: various clarifications (#23999)zeertzjq2023-06-12
| | | | | Close #18907 Close #20314 Close #23749
* docs: fix typos (#23917)Jonas Strittmatter2023-06-10
|
* docs: naming conventions, guidelinesJustin M. Keyes2023-02-22
| | | | close #21063
* docs(gen): support language annotation in docstringsChristian Clason2022-12-02
|
* docs(lua): opts in `vim.keymap.{set,del}` can be optional (#20255)Lewis Russell2022-09-20
|
* docs(lua): clarify vim.keymap.set() opts (#19761)Antoine Cotten2022-08-14
|
* docs: fix typos (#19588)dundargoc2022-08-03
| | | | Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: notomo <notomo.motono@gmail.com>
* test: improve mapping tests and docs (#19619)zeertzjq2022-08-02
|
* feat(api): add replace_keycodes to nvim_set_keymap (#19598)ii142022-08-01
|
* chore: format runtime with styluaChristian Clason2022-05-09
|
* fix(lua): don't mutate opts parameter of vim.keymap.del (#18227)Andrey Mishchenko2022-04-23
| | | | | | `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.
* docs: vim.keymap.set can specify buffer as an optionatusy2022-04-21
|
* fix(keymap): don't coerce false to ''Lewis Russell2022-04-01
|
* feat(keymap): return nil from an expr keymapLewis Russell2022-03-24
| | | | | For Lua callback expr keymaps, returning `nil` or `false` is equivalent to an empty string
* chore: fix typos (#17670)dundargoc2022-03-17
| | | Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* chore: fix typos (#17331)dundargoc2022-03-10
| | | | | | 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>
* chore: remove <Plug> detection from vim.keymapshadmansaleh2022-02-27
|
* feat(lua): add vim.keymapshadmansaleh2022-01-04
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 }) ```