diff --git a/docs/recipes.md b/docs/recipes.md index 066295c2..1071f6b9 100644 --- a/docs/recipes.md +++ b/docs/recipes.md @@ -39,18 +39,25 @@ completion = { ### Buffer completion from all open buffers +The default behavior is to only show completions from **visible** "normal" buffers (i.e. it woudldn't include neo-tree). This will instead show completions from all buffers, even if they're not visible on screen. Note that the performance impact of this has not been tested. + ```lua - providers = { - buffer = { - name = "Buffer", - module = "blink.cmp.sources.buffer", - opts = { - get_bufnrs = function() - return vim.api.nvim_list_bufs() - end, - }, - }, - }, +sources = { + providers = { + buffer = { + opts = { + -- get all buffers, even ones like neo-tree + get_bufnrs = vim.api.nvim_list_bufs + -- or (recommended) filter to only "normal" buffers + get_bufnrs = function() + return vim.tbl_filter(function(bufnr) + return vim.bo[bufnr].buftype == '' + end, vim.api.nvim_list_bufs()) + end + } + } + } +} ``` ### Don't show completion menu automatically in cmdline mode