Bufignore is a plugin for Neovim that helps you keep your buffer list
organized by automatically unlisting hidden buffers that match specific
ignore sources, such as a Lua pattern or Git ignored files. It was designed to
solve the annoyance of a cluttered buffer list when working with Git ignored
files, such as those within .git or node_modules.
https://user-images.githubusercontent.com/2284724/232234047-e170007b-7f31-4e6b-b727-ec62a0196710.mp4
hidden option set to on.{
'sQVe/bufignore.nvim',
dependencies = { 'nvim-lua/plenary.nvim' },
opts = {
-- Input configuration here.
-- Refer to the configuration section below for options.
}
},
use({
'sQVe/bufignore.nvim',
requires = { 'nvim-lua/plenary.nvim' },
config = function()
require("bufignore").setup({
-- Input configuration here.
-- Refer to the configuration section below for options.
})
end
})
The following code block shows the available options and their defaults:
{
auto_start = true,
ignore_sources = {
git = true,
patterns = { '/%.git/' },
symlink = true,
ignore_cwd_only = true,
},
pre_unlist = nil,
}
auto_startA boolean value that determines whether to start the plugin automatically
after calling setup().
ignore_sourcesA table that sets which sources to use when checking whether a file is
supposed to be unlisted or not.
gitA boolean value that determines whether Git ignored files are unlisted or not.
patternsA table of Lua patterns that determines whether the file should be unlisted or
not.
symlinkA boolean value that determines whether symlinked files are unlisted or not.
ignore_cwd_onlyA boolean value that determines whether to only unlist files that are within
the current working directory.
pre_unlistA callback function that executes before unlisting a buffer. You can use this
function to customize which buffers to unlist by returning a boolean value.
The unlisting process will only proceed if the callback function returns true.
event ({ bufnr: number, file_path: string }) - A table with buffer
information.Return true to proceed with the unlisting process, or anything else to prevent
the buffer from being unlisted.
Bufignore works out-of-the-box with the auto_start option enabled. The
following API is available under require('bufignore') if you want to handle
things manually:
setupSets up the plugin, see configuration for further information.
startStart the plugin.
stopStop the plugin.
All contributions to Bufignore are greatly appreciated, whether it's a bug fix or a feature request. If you would like to contribute, please don't hesitate to reach out via the issue tracker.
Before making a pull request, please consider the following: