Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/iron-e/nvim-bufmode

A mode for manipulating buffers in Neovim.
https://github.com/iron-e/nvim-bufmode

buffer-management buffers lua luajit mode neovim nvim nvim-libmodal plugin

Last synced: about 8 hours ago
JSON representation

A mode for manipulating buffers in Neovim.

Awesome Lists containing this project

README

        

# nvim-bufmode

`nvim-bufmode` is a plugin that provides a new mode in Neovim for managing buffers.

## Installation

Either use `packadd` or any package manager. I recommend using [lazy.nvim](https://github.com/folke/lazy.nvim).

### Requirements

* Neovim 0.7+
* [nvim-libmodal](https://github.com/Iron-E/nvim-libmodal)

### Examples

`lazy.nvim`:

```lua
{'Iron-E/nvim-bufmode',
cmd = 'BufmodeEnter', -- don't load until using this command
config = true, -- automatically call `bufmode.setup()`; not needed if you specify `opts`
dependencies = {
'Iron-E/nvim-libmodal',
-- 'akinsho/bufferline.nvim', (optional)
-- 'romgrk/barbar.nvim', (optional)
},
keys = {{'b', desc = 'Enter buffer mode', mode = 'n'}}, -- don't load until pressing these keys
-- opts = {}, (put `setup` options here, e.g. `opts = {enter_mapping = false}`
},
```

Other examples:

* [dein.vim](https://github.com/Shougo/dein.vim):
* Add `call dein#add('https://github.com/Iron-E/nvim-bufmode')` to `~/.config/nvim/init.vim`
* `:call dein#install()`
* [NeoBundle](https://github.com/Shougo/neobundle.vim):
* Add `NeoBundle 'https://github.com/Iron-E/nvim-bufmode'` to `~/.config/nvim/init.vim`
* Re-open vim or execute `:source ~/.vimrc`
* [vim-plug](https://github.com/junegunn/vim-plug):
* Add `Plug 'https://github.com/Iron-E/nvim-bufmode'` to `~/.config/nvim/init.vim`
* `:PlugInstall` or `$ vim +PlugInstall +qall`
* [Vundle](https://github.com/gmarik/vundle):
* Add `Plugin 'https://github.com/Iron-E/nvim-bufmode'` to `~/.config/nvim/init.vim`
* `:PluginInstall` or `$ vim +PluginInstall +qall`

## Usage

Enter `nvim-bufmode` with `b` or `:BufmodeEnter`.

| Key | Use |
|:--------------------------------------------------:|:---------------------------------:|
| `` | Leave `bufmode` |
| `?` | Show help message |
| `^`,`0`,``,`` | Go to beginning of buffer list. |
| `$`,``,`` | Go to end of buffer list. |
| `b`,`j`,`h`,``,`` | Go to buffer left. |
| `w`,`k`,`l`,``,`` | Go to buffer right. |
| ``,``,``,``,`` | Move current buffer to the left. |
| ``,``,``,``,`` | Move current buffer to the right. |
| `d` | Delete the current buffer. |
| `f`,`g`,`t` | Goto buffer by name. |
| `p` | Pick buffer for current window. |
| `r` | Replace current buffer with new. |

See `:help bufmode-usage` for additional details.

## Configuration

To customize the plugin, set `vim.g.bufmode_mappings` before loading it, or call
`setup` after:

```vim
let g:bufmode_mappings = {
\ '$': 'blast',
\ '0': 'bfirst',
\ '?': 'help bufmode-usage',
\ 'b': 'bprevious',
\ 'd': 'silent! bdelete',
\ 'w': 'bnext',
}
```
```lua
require('bufmode').setup {
enter_mapping = 'b', -- false to disable
bufferline = false, -- add bufferline.nvim keymaps
barbar = false, -- add barbar.nvim keymaps
keymaps = { -- defaults:
['$'] = 'blast',
['0'] = 'bfirst',
['?'] = 'help bufmode-usage',
['b'] = 'bprevious',
['d'] = 'silent! bdelete',
['w'] = 'bnext',
}
}
```