A simple and intuitive Neovim plugin for managing buffers with a floating menu interface built using nui.nvim.
- 🖥️ Floating Menu Interface: Clean, centered floating window for buffer navigation
- 📋 Buffer Information: Shows buffer ID, filename, and modification status
- 🗑️ Buffer Deletion: Delete buffers directly from the explorer
- 🔒 Safety Checks: Warns before deleting modified buffers
- ⌨️ Intuitive Keybindings: Vim-style navigation and actions
- 🎨 Clean UI: Minimal, distraction-free interface
Using lazy.nvim
{
"roshanlimbu/buffer-explorer",
dependencies = {
"MunifTanjim/nui.nvim",
"nvim-tree/nvim-web-devicons",
},
config = function()
-- Plugin loads automatically with default settings
end,
}Using packer.nvim
use {
"roshanlimbu/buffer-explorer",
requires = {
"MunifTanjim/nui.nvim",
"nvim-tree/nvim-web-devicons",
},
}- Clone this repository to your Neovim configuration directory:
git clone https://github.com/roshanlimbu/buffer-explorer ~/.config/nvim/pack/plugins/start/buffer-explorer- Install the dependencies:
- nui.nvim (required)
- nvim-web-devicons (optional, for file icons)
The plugin provides multiple ways to open the buffer explorer:
- Command:
:BufferExplorer - Default Keybinding:
<leader>be(in normal mode) - Programmatically:
require("buffer_explorer").open()
Once the buffer explorer is open, you can use the following keys:
| Key | Action |
|---|---|
j / <Down> / <Tab> |
Move to next buffer |
k / <Up> / <S-Tab> |
Move to previous buffer |
<Enter> / <Space> |
Switch to selected buffer |
d |
Delete selected buffer (with safety check) |
D |
Force delete selected buffer (ignores unsaved changes) |
i |
Show detailed buffer information |
<Esc> / <C-c> / q |
Close buffer explorer |
The buffer explorer displays:
- File Icons: Beautiful file icons from nvim-web-devicons (falls back to emoji icons if not available)
- Filename: The base name of the file (or
[No Name]for unnamed buffers) - Modification Status:
●indicator for buffers with unsaved changes
Example display:
┌─────┤ 🗂️ Buffer Explorer ├─────┐
│ │
│ init.lua ● │
│ README.md │
│ [No Name] │
│ styles.css │
│ main.py │
│ │
└─────┤ d:delete • esc:close ├────┘
When you press d to delete a buffer:
- If the buffer has unsaved changes, you'll get a warning message
- If the buffer is clean, it will be deleted immediately
- The buffer explorer refreshes automatically after deletion
- You cannot delete the last remaining buffer
Currently, the plugin works with default settings out of the box. The interface is designed to be clean and minimal.
The plugin sets up <leader>be as the default keybinding. If you want to change this, you can disable the default and set your own:
-- In your init.lua or plugin configuration
vim.keymap.set("n", "<your-preferred-key>", ":BufferExplorer<CR>",
{ desc = "Open buffer explorer", noremap = true, silent = true }
)- Neovim: 0.7.0 or higher
- Dependencies:
- nui.nvim - Required for the UI components
- nvim-web-devicons - Optional for beautiful file icons (falls back to emoji icons)
buffer-explorer/
├── lua/
│ └── buffer_explorer/
│ └── init.lua # Main plugin logic
├── plugin/
│ └── buffer_explorer.lua # Plugin initialization and commands
└── README.md # This file
Contributions are welcome! Please feel free to submit a pull request or create an issue.
To contribute to this plugin:
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes
- Test with your Neovim setup
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with nui.nvim for the beautiful UI components
- Inspired by the need for a simple, efficient buffer management solution
Q: Buffer explorer doesn't open
- Make sure
nui.nvimis installed and loaded - Check if there are any error messages with
:messages
Q: Keybinding doesn't work
- Verify your leader key is set correctly
- Check for conflicting keybindings with
:map <leader>be
Q: Buffer deletion doesn't work
- Make sure you have write permissions
- Check if the buffer is in use by another window
Q: No buffers shown in explorer
- The plugin only shows "listed" buffers
- Try opening some files first:
:edit filename
Happy buffer browsing! 🚀