backport: feat(api): rename buffer to buf (#38899)

feat(api): rename buffer to buf

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: Jordan <46637683+JordanllHarper@users.noreply.github.com>
This commit is contained in:
Justin M. Keyes
2026-04-08 21:23:13 -04:00
committed by GitHub
parent 8669e34bba
commit ed47b27ad4
27 changed files with 307 additions and 176 deletions

View File

@@ -18,6 +18,7 @@ error('Cannot require a meta file')
--- @class vim.api.keyset.clear_autocmds
--- @field buffer? integer
--- @field buf? integer
--- @field event? vim.api.keyset.events|vim.api.keyset.events[]
--- @field group? integer|string
--- @field pattern? string|string[]
@@ -226,6 +227,7 @@ error('Cannot require a meta file')
--- @class vim.api.keyset.create_autocmd
--- @field buffer? integer
--- @field buf? integer
--- @field callback? string|fun(args: vim.api.keyset.create_autocmd.callback_args): boolean?
--- @field command? string
--- @field desc? string
@@ -258,6 +260,7 @@ error('Cannot require a meta file')
--- @class vim.api.keyset.exec_autocmds
--- @field buffer? integer
--- @field buf? integer
--- @field group? integer|string
--- @field modeline? boolean
--- @field pattern? string|string[]
@@ -271,6 +274,7 @@ error('Cannot require a meta file')
--- @field group? integer|string
--- @field pattern? string|string[]
--- @field buffer? integer|integer[]
--- @field buf? integer|integer[]
--- @field id? integer
--- @class vim.api.keyset.get_commands