Skip to content

A simple and intuitive Neovim plugin for managing buffers with a floating menu interface built using nui.nvim.

Notifications You must be signed in to change notification settings

roshanlimbu/buffer-explorer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Buffer Explorer

A simple and intuitive Neovim plugin for managing buffers with a floating menu interface built using nui.nvim.

Features

  • 🖥️ 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

Installation

Using lazy.nvim

{
  "roshanlimbu/buffer-explorer",
  dependencies = {
    "MunifTanjim/nui.nvim",
    "nvim-tree/nvim-web-devicons",
  },
  config = function()
    -- Plugin loads automatically with default settings
  end,
}
use {
  "roshanlimbu/buffer-explorer",
  requires = {
    "MunifTanjim/nui.nvim",
    "nvim-tree/nvim-web-devicons",
  },
}

Manual Installation

  1. Clone this repository to your Neovim configuration directory:
git clone https://github.com/roshanlimbu/buffer-explorer ~/.config/nvim/pack/plugins/start/buffer-explorer
  1. Install the dependencies:

Usage

Opening the Buffer Explorer

The plugin provides multiple ways to open the buffer explorer:

  1. Command: :BufferExplorer
  2. Default Keybinding: <leader>be (in normal mode)
  3. Programmatically: require("buffer_explorer").open()

Navigation

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

Buffer Information

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 ├────┘

Buffer Deletion

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

Configuration

Currently, the plugin works with default settings out of the box. The interface is designed to be clean and minimal.

Default Keybinding

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 }
)

Requirements

  • 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)

File Structure

buffer-explorer/
├── lua/
│   └── buffer_explorer/
│       └── init.lua          # Main plugin logic
├── plugin/
│   └── buffer_explorer.lua   # Plugin initialization and commands
└── README.md                 # This file

Contributing

Contributions are welcome! Please feel free to submit a pull request or create an issue.

Development

To contribute to this plugin:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes
  4. Test with your Neovim setup
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Built with nui.nvim for the beautiful UI components
  • Inspired by the need for a simple, efficient buffer management solution

Troubleshooting

Common Issues

Q: Buffer explorer doesn't open

  • Make sure nui.nvim is 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! 🚀

About

A simple and intuitive Neovim plugin for managing buffers with a floating menu interface built using nui.nvim.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages