akinsho / bufferline.nvim

A snazzy bufferline for Neovim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: Outdated bufferline-functions Documentation

mcDevnagh opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

The documentation has an outdated means of executing arbitrary functions on buffers:

CUSTOM-FUNCTIONS *bufferline-functions*

CUSTOM-FUNCTIONS                                     *bufferline-functions*

A user can also execute arbitrary functions against a buffer using the
`buf_exec` function. For example

>lua
    require('bufferline').buf_exec(
        4, -- the forth visible buffer from the left
        user_function -- an arbitrary user function which gets passed the buffer
    )

    -- e.g.
    function _G.bdel(num)
        require('bufferline').buf_exec(num, function(buf, visible_buffers)
            vim.cmd('bdelete '..buf.id)
        end
    end

    vim.cmd [[
        command -count Bdel <Cmd>lua _G.bdel(<count>)<CR>
    ]]

The buf_exec function no longer exists in the bufferline module
The exec function in the bufferline.commands module seems to be its replacement

What did you expect to happen?

The documentation should contain:

CUSTOM-FUNCTIONS                                     *bufferline-functions*

A user can also execute arbitrary functions against a buffer using the
`exec` function in the `bufferline.commands` module. For example

>lua
    require("bufferline.commands").exec(
        4, -- the forth visible buffer from the left
        user_function -- an arbitrary user function which gets passed the buffer
    )

    -- e.g.
    function _G.bdel(num)
        require("bufferline.commands").exec(num, function(bufnr, visible_buffers)
            vim.cmd('bdelete '..bufnr)
        end
    end

    vim.cmd [[
        command -count Bdel <Cmd>lua _G.bdel(<count>)<CR>
    ]]

see:

function M.exec(index, func)

Config

N/A

Additional Information

...

commit

No response

commented

@mcDevnagh thanks for pointing this out please still free to raise a pr and I can review and update the docs