mirror of
https://github.com/neovim/neovim.git
synced 2026-04-19 22:10:45 +00:00
feat(api): rename buffer to buf #35330
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>
This commit is contained in:
@@ -475,7 +475,7 @@ function M.inspect_tree(opts)
|
||||
|
||||
api.nvim_create_autocmd('CursorMoved', {
|
||||
group = group,
|
||||
buffer = b,
|
||||
buf = b,
|
||||
callback = function()
|
||||
if not api.nvim_buf_is_loaded(buf) then
|
||||
return true
|
||||
@@ -509,7 +509,7 @@ function M.inspect_tree(opts)
|
||||
|
||||
api.nvim_create_autocmd('CursorMoved', {
|
||||
group = group,
|
||||
buffer = buf,
|
||||
buf = buf,
|
||||
callback = function()
|
||||
if not api.nvim_buf_is_loaded(b) then
|
||||
return true
|
||||
@@ -521,7 +521,7 @@ function M.inspect_tree(opts)
|
||||
|
||||
api.nvim_create_autocmd({ 'TextChanged', 'InsertLeave' }, {
|
||||
group = group,
|
||||
buffer = buf,
|
||||
buf = buf,
|
||||
callback = function()
|
||||
if not api.nvim_buf_is_loaded(b) then
|
||||
return true
|
||||
@@ -536,7 +536,7 @@ function M.inspect_tree(opts)
|
||||
|
||||
api.nvim_create_autocmd('BufLeave', {
|
||||
group = group,
|
||||
buffer = b,
|
||||
buf = b,
|
||||
callback = function()
|
||||
if not api.nvim_buf_is_loaded(buf) then
|
||||
return true
|
||||
@@ -547,7 +547,7 @@ function M.inspect_tree(opts)
|
||||
|
||||
api.nvim_create_autocmd('BufLeave', {
|
||||
group = group,
|
||||
buffer = buf,
|
||||
buf = buf,
|
||||
callback = function()
|
||||
if not api.nvim_buf_is_loaded(b) then
|
||||
return true
|
||||
@@ -558,7 +558,7 @@ function M.inspect_tree(opts)
|
||||
|
||||
api.nvim_create_autocmd({ 'BufHidden', 'BufUnload', 'QuitPre' }, {
|
||||
group = group,
|
||||
buffer = buf,
|
||||
buf = buf,
|
||||
callback = function()
|
||||
-- don't close inpector window if source buffer
|
||||
-- has more than one open window
|
||||
@@ -677,7 +677,7 @@ function M.edit_query(lang)
|
||||
local group = api.nvim_create_augroup('nvim.treesitter.dev_edit', {})
|
||||
api.nvim_create_autocmd({ 'TextChanged', 'InsertLeave' }, {
|
||||
group = group,
|
||||
buffer = query_buf,
|
||||
buf = query_buf,
|
||||
desc = 'Update query editor diagnostics when the query changes',
|
||||
callback = function()
|
||||
vim.treesitter.query.lint(query_buf, { langs = lang, clear = false })
|
||||
@@ -685,7 +685,7 @@ function M.edit_query(lang)
|
||||
})
|
||||
api.nvim_create_autocmd({ 'TextChanged', 'InsertLeave', 'CursorMoved', 'BufEnter' }, {
|
||||
group = group,
|
||||
buffer = query_buf,
|
||||
buf = query_buf,
|
||||
desc = 'Update query editor highlights when the cursor moves',
|
||||
callback = function()
|
||||
if api.nvim_win_is_valid(win) then
|
||||
@@ -695,7 +695,7 @@ function M.edit_query(lang)
|
||||
})
|
||||
api.nvim_create_autocmd('BufLeave', {
|
||||
group = group,
|
||||
buffer = query_buf,
|
||||
buf = query_buf,
|
||||
desc = 'Clear highlights when leaving the query editor',
|
||||
callback = function()
|
||||
api.nvim_buf_clear_namespace(buf, edit_ns, 0, -1)
|
||||
@@ -703,7 +703,7 @@ function M.edit_query(lang)
|
||||
})
|
||||
api.nvim_create_autocmd('BufLeave', {
|
||||
group = group,
|
||||
buffer = buf,
|
||||
buf = buf,
|
||||
desc = 'Clear the query editor highlights when leaving the source buffer',
|
||||
callback = function()
|
||||
if not api.nvim_buf_is_loaded(query_buf) then
|
||||
@@ -715,7 +715,7 @@ function M.edit_query(lang)
|
||||
})
|
||||
api.nvim_create_autocmd({ 'BufHidden', 'BufUnload' }, {
|
||||
group = group,
|
||||
buffer = buf,
|
||||
buf = buf,
|
||||
desc = 'Close the editor window when the source buffer is hidden or unloaded',
|
||||
once = true,
|
||||
callback = function()
|
||||
|
||||
Reference in New Issue
Block a user