Skip to content

Persistent bookmarks: powerful but simple (one shortcut to add, rename, and remove bookmark)

License

Notifications You must be signed in to change notification settings

LintaoAmons/bookmarks.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bookmarks.nvim

  • 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.
image

Install and Config

-- 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

Usage

Commands

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

Keymap

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

CONTRIBUTING

Don't hesitate to ask me anything about the codebase if you want to contribute.

By telegram or 微信: CateFat

  • How to get started:
    1. plugin/bookmarks.lua the entry point of the plugin
    2. lua/bookmarks/domain where the main objects/concepts live

Some Other Neovim Stuff

About

Persistent bookmarks: powerful but simple (one shortcut to add, rename, and remove bookmark)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages