Navigate within your project files using ergonomic marks.
- Lua 100%
| lua/bufmarks | 🔧 Internalize mark/navigate verbs for mappings. | |
| plugin | ✨ Accepting/validate first option: bufmark folder. | |
| LICENSE | 🌐 License under GPL-3. | |
| README.md | 📖 Illustrate with asciinema. | |
| stylua.toml | 🐛 Several marks may point to the same file. | |
This nvim navigation plugin gets its inspiration from Harpoon, but it indexes buffers with "mark"-like keys instead of a plain ordered list.
-- Install.
vim.pack.add({
"https://codeberg.org/iago-lito/bufmarks.nvim",
})
-- Configure.
local bm = require("bufmarks")
bm.setup({
-- Where to store marks files (defaults to the following).
data = vim.fs.joinpath(vim.fn.stdpath("data"), "bufmarks"),
})
-- Every "project" has its own independent set of marks.
-- You get to decide what a bufmark "project" is or means.
-- In this example, a bufmark "project" is the folder where vim was started.
vim.api.nvim_create_autocmd("VimEnter", {
group = vim.api.nvim_create_augroup("BufMarkProject", { clear = true }),
callback = function()
bm.set_project(vim.fn.getcwd())
end,
})
-- No default mapping: choose your own.
vim.keymap.set("n", "<+", bm.mark) -- Hit <+a to mark current file.
vim.keymap.set("n", "<", bm.navigate) -- Hit <a to navigate to file marked with 'a'.
vim.keymap.set("n", "<>", bm.display) -- Hit <> to see/edit current marks.
-- Quit the display window with 'q`, or use `<cr>` to navigate to the mark under cursor.