https://github.com/johnpmitsch/buf-jump.nvim
https://github.com/johnpmitsch/buf-jump.nvim
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/johnpmitsch/buf-jump.nvim
- Owner: johnpmitsch
- License: mit
- Created: 2025-12-03T16:35:28.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-12-03T17:34:58.000Z (6 months ago)
- Last Synced: 2025-12-06T21:33:25.794Z (6 months ago)
- Language: Lua
- Size: 3.91 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# buf-jump.nvim
A lightweight buffer history navigation plugin for Neovim. Navigate through your buffer history per-window, similar to how you navigate web browser history.
## Features
- **Per-window history** — Each window maintains its own independent buffer history
- **Familiar navigation** — Jump back and forward through buffers you've visited
- **Count support** — Use `3bjp` to jump back 3 buffers at once
- **Clean history** — Automatically removes deleted buffers and ignores unlisted/unnamed buffers
- **Zero dependencies** — Pure Lua, no external requirements
## Requirements
- Neovim ≥ 0.7.0
## Installation
lazy.nvim
```lua
{
"johnpmitsch/buf-jump.nvim",
event = "BufWinEnter",
opts = {},
}
```
packer.nvim
```lua
use {
"johnpmitsch/buf-jump.nvim",
config = function()
require("buf-jump").setup()
end,
}
```
mini.deps
```lua
MiniDeps.add("johnpmitsch/buf-jump.nvim")
require("buf-jump").setup()
```
Manual
Clone to your Neovim packages directory:
```bash
git clone https://github.com/johnpmitsch/buf-jump.nvim \
~/.local/share/nvim/site/pack/plugins/start/buf-jump.nvim
```
Then add to your config:
```lua
require("buf-jump").setup()
```
## Configuration
```lua
require("buf-jump").setup({
-- Set to false to disable default keymaps
-- Set to a table to customize them
mappings = {
list = "bjl", -- Show buffer history
back = "bjp", -- Go to previous buffer
forward = "bjn", -- Go to next buffer
},
})
```
### Examples
**Using different keymaps:**
```lua
require("buf-jump").setup({
mappings = {
list = "bl",
back = "[b",
forward = "]b",
},
})
```
**Commands only (no keymaps):**
```lua
require("buf-jump").setup({
mappings = false,
})
```
## Usage
| Keymap | Command | Description |
|--------|---------|-------------|
| `bjl` | `:BufJumpList` | Display buffer history for current window |
| `bjp` | `:BufJumpBack` | Jump to previous buffer in history |
| `bjn` | `:BufJumpForward` | Jump to next buffer in history |
All navigation commands support counts:
```
3bjp " Jump back 3 buffers
2bjn " Jump forward 2 buffers
:5BufJumpBack
```
## API
For programmatic use or custom keymaps:
```lua
local bj = require("buf-jump")
bj.back() -- Go back one buffer
bj.back(3) -- Go back 3 buffers
bj.forward() -- Go forward one buffer
bj.forward(2) -- Go forward 2 buffers
bj.list() -- Print buffer history
bj.add(bufnr) -- Manually add a buffer to history
bj.remove(bufnr) -- Remove a buffer from history
bj.remove(-1) -- Clear all history
```
## How It Works
buf-jump maintains a per-window stack of visited buffers. When you enter a buffer, it's added to the current window's history. The plugin tracks your position in this history, allowing you to move backward and forward through previously visited buffers.
Unlike Neovim's built-in jumplist (`:jumps`), which tracks cursor positions across files, buf-jump focuses purely on buffer navigation—making it ideal for quickly switching between files you're actively working on.
## License
MIT