- Simple: Add, Rename and Remove bookmarks with only one command, less shortcuts more productivity.
- Persistent: save your bookmarks into a sqlite db file
- Accessible: Find your bookmark by telescope or Treeview with ease.
- Informative: mark with a name or description, so you can record more information.
- Visibility: display icon and name at the marked lines, and highlight marked lines.
- Lists: arrange your bookmarks in lists, organise the bookmarks in your way.
-- with lazy.nvim
return {
"LintaoAmons/bookmarks.nvim",
-- recommand, pin the plugin at specific version for stability
-- backup your db.json file when you want to upgrade the plugin
tag = "v2.2.0",
dependencies = {
{"kkharji/sqlite.lua"},
{"nvim-telescope/telescope.nvim"},
{"stevearc/dressing.nvim"} -- optional: better UI
},
config = function()
local opts = {} -- go to the following section to see all the options
require("bookmarks").setup(opts) -- you must call setup to init sqlite db
end,
}
-- run :BookmarksInfo to see the running status of the plugin
Check the default config in config.lua
Command | Description |
---|---|
BookmarksMark |
Mark current line into active BookmarkList. Rename existing bookmark under cursor. Toggle it off if the new name is an empty string |
BookmarksGoto |
Go to bookmark at current active BookmarkList |
BookmarksGotoNext |
Go to next bookmark in line number order within the current active BookmarkList |
BookmarksGotoPrev |
Go to previous bookmark in line number order within the current active BookmarkList |
BookmarksDesc |
Add description to the bookmark under cursor, if no bookmark, then mark it first |
BookmarksTree |
Browse bookmarks in tree view |
BookmarksCommands |
Find bookmark commands and trigger it |
BookmarksInfo |
Overview plugin current status |
BookmarksInfoCurrentBookmark |
Show current bookmark info |
BookmarksGrep |
Grep through the content of all bookmarked files |
BookmarksLists |
Pick a bookmark list |
BookmarksNewList |
Create a new bookmark list |
BookmarkRebindOrphanNode |
Rebind orphaned nodes by attaching them to the root node |
This plugin doesn't provide any default keybinding. I recommend you to have these four keybindings.
vim.keymap.set({ "n", "v" }, "mm", "<cmd>BookmarksMark<cr>", { desc = "Mark current line into active BookmarkList." })
vim.keymap.set({ "n", "v" }, "mo", "<cmd>BookmarksGoto<cr>", { desc = "Go to bookmark at current active BookmarkList" })
vim.keymap.set({ "n", "v" }, "ma", "<cmd>BookmarksCommands<cr>", { desc = "Find and trigger a bookmark command." })
When using the bookmark picker (:BookmarksGoto
), the following shortcuts are available:
Shortcut | Action |
---|---|
Enter |
Go to selected bookmark |
<C-x> |
Open selected bookmark in horizontal split |
<C-v> |
Open selected bookmark in vertical split |
<C-t> |
Open selected bookmark in new tab |
<C-d> |
Delete selected bookmark and refresh the picker |
Don't hesitate to ask me anything about the codebase if you want to contribute.
By telegram or 微信: CateFat
- How to get started:
plugin/bookmarks.lua
the entry point of the pluginlua/bookmarks/domain
where the main objects/concepts live