Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ojroques/nvim-bufdel
A Neovim plugin to improve buffer deletion
https://github.com/ojroques/nvim-bufdel
nvim-lua nvim-plugin
Last synced: 16 days ago
JSON representation
A Neovim plugin to improve buffer deletion
- Host: GitHub
- URL: https://github.com/ojroques/nvim-bufdel
- Owner: ojroques
- License: bsd-2-clause
- Created: 2021-01-28T21:53:31.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-12-27T09:44:03.000Z (11 months ago)
- Last Synced: 2024-10-12T22:34:14.554Z (about 1 month ago)
- Topics: nvim-lua, nvim-plugin
- Language: Lua
- Homepage:
- Size: 249 KB
- Stars: 168
- Watchers: 4
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nvim-bufdel
A small Neovim plugin to improve the deletion of buffers.
Improvements:
* **Preserve the layout of windows.** Deleting a buffer will no longer close any
window unexpectedly (see demo).
* **Cycle through buffers according to their number**
([configurable](#configuration)). This is especially helpful when using a
bufferline: we get the same behavior as closing tabs in Chrome / Firefox (see
demo).
* **Terminal buffers are deleted without prompt.**
* **Exit Neovim when last buffer is deleted** ([configurable](#configuration)).
* **Add commands to close all listed buffers and to close them all except the
current one.**![demo](https://user-images.githubusercontent.com/23409060/188604956-51b33576-df09-41f2-aead-9d3685686d3f.gif)
Here the same buffer is displayed in left and top-right window. Deleting that
buffer preserves the window layout and the first buffer with a number greater
than the deleted one is selected instead (the one immediately to the right in
the bufferline).## Installation
With [packer.nvim](https://github.com/wbthomason/packer.nvim):
```lua
use {'ojroques/nvim-bufdel'}
```With [paq-nvim](https://github.com/savq/paq-nvim):
```lua
paq {'ojroques/nvim-bufdel'}
```## Usage
Delete the current buffer:
```vim
:BufDel
```Delete the current buffer and ignore changes:
```vim
:BufDel!
```Delete a buffer by its name or number (use quotes in case the buffer name is a
number):
```vim
:BufDel
```Delete all listed buffers (add `!` to ignore changes):
```vim
:BufDelAll
```Delete all listed buffers except the current one (add `!` to ignore changes):
```vim
:BufDelOthers
```## Configuration
You can pass options to the `setup()` function. Here are the default options:
```lua
require('bufdel').setup {
next = 'tabs',
quit = true, -- quit Neovim when last buffer is closed
}
```The `next` option determines the next buffer to display after deletion.
Supported values:
* `cycle`: cycle through buffers according to their number.
* `tabs` (*default*): like `cycle` but when the buffer with highest number is
deleted, display the new highest buffer instead of going back to the first
one.
* `alternate`: switch to the alternate buffer (same behavior as without the
plugin).
* You can also pass your own function to select the next buffer.