diff --git a/docs/recipes.md b/docs/recipes.md index 9b5cf3da..1071f6b9 100644 --- a/docs/recipes.md +++ b/docs/recipes.md @@ -37,6 +37,29 @@ 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 +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 ```lua