bookmarks.nvim is a simple bookmarks manager for neovim. It is inspired by bookmarks.vim.
- Features
- Installation
- Configuration
- Mappings
- Telescope extension
- Picker.nvim source
- API
- Self-Promotion
- License
- Toggle bookmarks on any line
- Add annotations to bookmarks
- Navigate between bookmarks in current buffer
- List all bookmarks via quickfix list
- Telescope extension support
- Picker.nvim source support
- Bookmarks persist across sessions
- Auto-update bookmark positions when lines are modified
{
'wsdjeg/bookmarks.nvim',
keys = {
{ 'mm', '<Plug>(bookmarksToggle)', mode = 'n' },
{ 'mi', '<Plug>(bookmarksAnnotation)', mode = 'n' },
{ 'mn', '<Plug>(bookmarksNext)', mode = 'n' },
{ 'mp', '<Plug>(bookmarksPrevious)', mode = 'n' },
{ 'mc', '<Plug>(bookmarksClear)', mode = 'n' },
{ 'ma', '<Plug>(bookmarksListAll)', mode = 'n' },
},
opts = {
sign_text = '=>',
sign_hl_group = 'Normal',
},
dependencies = {
'wsdjeg/notify.nvim',
'wsdjeg/logger.nvim',
},
}require('plug').add({
{
'wsdjeg/bookmarks.nvim',
keys = {
{ 'n', 'mm', '<Plug>(bookmarksToggle)', { noremap = false } },
{ 'n', 'mi', '<Plug>(bookmarksAnnotation)', { noremap = false } },
{ 'n', 'mn', '<Plug>(bookmarksNext)', { noremap = false } },
{ 'n', 'mc', '<Plug>(bookmarksClear)', { noremap = false } },
{ 'n', 'ma', '<Plug>(bookmarksListAll)', { noremap = false } },
{ 'n', 'mp', '<Plug>(bookmarksPrevious)', { noremap = false } },
},
opts = {
sign_text = '=>',
sign_hl_group = 'Normal',
},
depends = { { 'wsdjeg/notify.nvim' }, { 'wsdjeg/logger.nvim' } },
},
})The plugin can be configured by passing options to the setup() function or via the opts field in your package manager.
| Option | Type | Default | Description |
|---|---|---|---|
sign_text |
string | '=>' |
The sign text displayed in the sign column |
sign_hl_group |
string | 'Normal' |
The highlight group for the sign |
Example:
require('bookmarks').setup({
sign_text = '⚑', -- Use a bookmark symbol
sign_hl_group = 'WarningMsg', -- Use a different highlight
})| mappings | description |
|---|---|
<Plug>(bookmarksToggle) |
toggle bookmark of current line |
<Plug>(bookmarksAnnotation) |
add annotation bookmark |
<Plug>(bookmarksNext) |
jump to next bookmark in current buffer |
<Plug>(bookmarksClear) |
clear bookmarks in current buffer |
<Plug>(bookmarksListAll) |
list all bookmarks in quickfix window |
<Plug>(bookmarksPrevious) |
jump to previous bookmark in current buffer |
This plugin provides a telescope extension, which can be started using the :Telescope bookmarks command.
:Telescope bookmarksThis plugin also provides a source for picker.nvim:
:Picker bookmarksYou can also use the following Lua API in your own plugins:
local bookmarks = require('bookmarks')
-- Get all bookmarks
local all_bookmarks = bookmarks.get()
-- Toggle bookmark at current line
bookmarks.toggle()
-- Add bookmark with annotation
bookmarks.add(file, lnum, annotation, context)
-- Add annotation to current line
bookmarks.annotation()
-- Jump to next/previous bookmark in current buffer
bookmarks.next_bookmark()
bookmarks.previous_bookmark()
-- Clear all bookmarks in current buffer
bookmarks.clear()
-- List all bookmarks in quickfix window
bookmarks.setqflist()Like this plugin? Star the repository on GitHub.
Love this plugin? Follow me on GitHub.
This project is licensed under the GPL-3.0 License.