summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/api/autocmd_spec.lua
AgeCommit message (Collapse)AuthorFiles
2026-04-13feat(api): rename buffer to buf in retval #38900Justin M. Keyes1
In 3a4a66017b74192caaf9af9af172bdc08e0c1608, 4d3a67cd620152d11ab9b5f5bdd973f84cc2d44b we renamed "buffer" to "buf" in dict parameters. This commit also renames such keys in dict return-values.
2026-04-08feat(api): rename buffer to buf #35330Jordan1
Problem: `:help dev-name-common` states that "buf" should be used instead of "buffer" but there are cases where buffer is mentioned in the lua API. Solution: - Rename occurrences of "buffer" to "buf" for consistency with the documentation. - Support (but deprecate) "buffer" for backwards compatibility. Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2026-04-08fix(api)!: nvim_clear_autocmds() "event" handlingSean Dewar1
Problem: nvim_clear_autocmds() does not type check "event" correctly, and also treats an empty array "event" like nil. Solution: fix type checking. Treat empty array "event" as a no-op, like nvim_exec_autocmds(). Add some extra tests. Likewise the nil handling change may be considered breaking if anyone (unintentionally) relied on that. It was also true that integer, function, etc. "event"s would also be treated like nil! Note that an empty string "event" is still an error, as that's must be an exact match on an event name.
2026-04-08docs(api): nvim_exec_autocmds() default "pattern"Sean Dewar1
Problem: nvim_exec_autocmds() documentation incorrectly describes the default for "pattern" as *, when it's actually the current file name (like :doautocmd). Solution: correct it. Add a test.
2026-04-08fix(api)!: empty non-nil autocmd "pattern" handlingSean Dewar1
Problem: in autocmd APIs, a non-nil "pattern" containing only empty 'sub'-patterns is silently treated as nil, causing the fallback value to be unexpectedly used instead. Solution: for nvim_create_autocmd(), raise a validation error (as no autocmds would be created). For nvim_{exec,clear}_autocmds(), make it a no-op (as matching no autocmds is not an error).
2026-03-17docs: api, lsp, messages, intro #38327Justin M. Keyes1
2026-03-12docs: use "ev" convention in event-handlersJustin M. Keyes1
Problem: In autocmd examples, using "args" as the event-object name is vague and may be confused with a user-command. Solution: Use "ev" as the conventional event-object name.
2025-09-24test: remove a few more redundant clear() calls (#35903)zeertzjq1
2025-01-26feat(api): nvim_get_autocmds filter by id#31549glepnir1
Problem: nvim_get_autocmds cannot filter by id. Solution: Support it.
2024-12-06fix(events): don't expand `args.file` for Lua callback (#31473)zeertzjq1
Problem: In an autocommand Lua callback whether `args.file` is expanded depends on whether `expand('<afile>')` has been called. Solution: Always use the unexpanded file name for `args.file`. Related to #31306 and vim/vim#16106. This doesn't provide `sfname`, but at least makes `args.file` have a consistent value.
2024-04-23test: improve test conventionsdundargoc1
Specifically, functions that are run in the context of the test runner are put in module `test/testutil.lua` while the functions that are run in the context of the test session are put in `test/functional/testnvim.lua`. Closes https://github.com/neovim/neovim/issues/27004.
2024-04-17fix(lua): only free luarefs when returning from API (#28373)zeertzjq1
2024-04-16test: getting autocmd Lua callback in Vimscript (#28367)zeertzjq1
Also remove unnecessary variable in API converter.
2024-04-10refactor(test): inject after_each differentlyLewis Russell1
2024-04-08test: improve test conventionsdundargoc1
Work on https://github.com/neovim/neovim/issues/27004.
2024-01-12test: rename (meths, funcs) -> (api, fn)Lewis Russell1
2024-01-12test: normalise nvim bridge functionsLewis Russell1
- remove helpers.cur*meths - remove helpers.nvim
2024-01-12test: typing for helpers.methsLewis Russell1
2024-01-03refactor: format test/*Justin M. Keyes1
2023-10-29docs: small fixes (#25585)dundargoc1
Co-authored-by: tmummert <doczook@gmx.de> Co-authored-by: parikshit adhikari <parikshitadhikari@gmail.com>
2023-10-09fix(autocmd): API functions accept garbage after event name #25523ii141
"VimEnter foo" was accepted as a valid event name for "VimEnter". Events delimited with commas, eg. "VimEnter,BufRead", were also accepted, even though only the first event was actually parsed. Co-authored-by: ii14 <ii14@users.noreply.github.com>
2023-08-07test(api): update tests to new error messagesbfredl1
2023-06-07fix(events): don't expand non-file as file namezeertzjq1
2023-04-23fix(api): avoid assertion when autocmd group id is 0 (#23210)Dhruv Manilawala1
2023-02-14Merge #22214 move init_default_autocmds to luaJustin M. Keyes1
2023-02-14refactor(api): consistent VALIDATE messages #22262Justin M. Keyes1
Problem: Validation messages are not consistently formatted. - Parameter names sometimes are NOT quoted. - Descriptive names (non-parameters) sometimes ARE quoted. Solution: Always quote the `name` value passed to a VALIDATE macro _unless_ the value has whitespace.
2023-02-14refactor(api): VALIDATE macros #22256Justin M. Keyes1
- VALIDATE() takes a format string - deduplicate check_string_array - VALIDATE_RANGE - validate UI args
2023-02-14refactor(api): VALIDATE macros #22187Justin M. Keyes1
Problem: - API validation involves too much boilerplate. - API validation errors are not consistently worded. Solution: Introduce some macros. Currently these are clumsy, but they at least help with consistency and avoid some nesting.
2023-02-11refactor: move init_default_autocmds to luaglacambre1
The original motivation for this change came from developping https://github.com/neovim/neovim/pull/22159, which will require adding more autocommand creation to Neovim's startup sequence. This change requires lightly editing a test that expected no autocommand to have been created from lua.
2023-01-12fix(api): nvim_create_autocmd crash on invalid types inside pattern arrayii141
Co-authored-by: ii14 <ii14@users.noreply.github.com>
2022-12-11docs #20986Justin M. Keyes1
- https://github.com/neovim/tree-sitter-vimdoc v1.2.4 eliminates most errors in pi_netrw.txt, so we can remove that workaround from ignore_parse_error(). - improved codeblock
2022-06-26feat(api): support pattern array for exec_autocmdsChristian Clason1
2022-06-09feat(autocmds): retrieve lua callback (#18642)kylo2521
add a new `callback` field to `nvim_get_autocmds`
2022-05-21fix(autocmds): separate command from desc (#18617)kylo2521
2022-05-18feat(api): enable nvim_exec_autocmds to pass arbitrary data (#18613)Gregory Anders1
Add a "data" key to nvim_exec_autocmds that passes arbitrary data (API objects) to autocommand callbacks.
2022-05-05feat(api): add `group_name` to `nvim_get_autocmds`Famiu Haque1
2022-04-26test: correct order of arguments to eq() and neq()zeertzjq1
2022-04-08feat(api)!: pass args table to autocommand callbacksGregory Anders1
2022-04-01Merge pull request #17938 from ggandor/autocmd-api-namesbfredl1
refactor(api)!: use singular/plural consistently in the autocmd API
2022-03-31refactor(api)!: use singular/plural consistently in the autocmd APIGyörgy Andorka1
2022-03-31Merge pull request #17929 from lewis6991/autocmdbfredl1
fix(api): improve autocmd error handling
2022-03-31fix(api): improve autocmd error handlingLewis Russell1
- nvim_del_augroup_* now works with pcall - nvim_del_autocmd now errors for invalid ids
2022-03-31feat(api): nvim_clear_autocmdTJ DeVries1
Co-authored-by: Christian Clason <christian.clason@uni-due.de>
2022-03-30fix: set nested before executing callback (#17801)TJ DeVries1
2022-03-26refactor!: rename nvim_do_autocmd to nvim_exec_autocmd (#17854)Javier Lopez1
according to established code standards (`:h dev-api`)
2022-03-19feat(api): remove Lua autocommand callbacks when they return true (#17784)Gregory Anders1
This copies the semantics of nvim_buf_attach callbacks, and is a convenient way to create oneshot autocommands gated by some condition.
2022-03-07feat(api): autocmd `group` can be either name or id (#17559)Dhruv Manilawala1
* feat(api): `group` can be either string or int This affects the following API functions: - `vim.api.nvim_create_autocmd` - `vim.api.nvim_get_autocmds` - `vim.api.nvim_do_autocmd` closes #17552 * refactor: add two maps for fast lookups * fix: delete augroup info from id->name map When in "stupid_legacy_mode", the value in name->id map would be updated to `AUGROUP_DELETED`, but the entry would still remain in id->name. This would create a problem in `augroup_name` function which would return the name of the augroup instead of `--DELETED--`. The id->name map is only used for fast loopup in `augroup_name` function so there's no point in keeping the entry of deleted augroup in it. Co-authored-by: TJ DeVries <devries.timothyj@gmail.com>
2022-03-06feat(api): add 'buffer' argument to nvim_get_autocmds (#17594)Gregory Anders1
This enables retrieving autocommands defined in the given buffers. Under the hood this simply translates the buffer numbers into '<buffer=%d>' patterns.
2022-03-01fix(api): include event in get_autocmds (#17553)Christian Clason1
2022-02-28feat(lua): add missing changes to autocmds lost in the rebaseTJ DeVries1
Note: some of these changes are breaking, like change of API signatures