Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bufonly.nvim

Close every buffer except the current one.

Overview

:bufdo bd closes everything including the buffer you're on, and doesn't protect unsaved changes. :BufOnly keeps the current buffer, skips unlisted buffers (help windows, quickfix, etc.), and by default skips buffers with unsaved changes rather than silently discarding work.

Install

With lazy.nvim:

{ "Hinikaa/bufonly.nvim" }

With packer.nvim:

use "Hinikaa/bufonly.nvim"

No setup() call needed -- the :BufOnly command registers itself.

Usage

:BufOnly    " closes every other listed buffer, skipping ones with unsaved changes
:BufOnly!   " force: also closes buffers with unsaved changes, discarding them

Notes

  • The buffer-selection logic (buffers_to_close) is pure and separated from the vim.api calls, so it's tested both offline (lua5.1 test.lua) and against a real headless Neovim instance driving the actual :BufOnly command.

License

MIT, see LICENSE.

About

Close every buffer except the current one, Neovim plugin

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages