Home

Awesome

NOTE

This plugin is unmaintained, since I'm not using vim-bookmarks anymore. It's possible that things will not work anymore with recent versions of telescope and/or vim-bookmarks. If somebody wants to take over as a maintainer, let me know.

telescope-vim-bookmarks.nvim

Telescope picker for the vim-bookmarks plugin.

Installation

Install with your favorite plugin manager and add

require('telescope').load_extension('vim_bookmarks')

somewhere after loading telescope.

Usage

The extension provides two new pickers:

" Pick from all bookmarks
:Telescope vim_bookmarks all
" Only pick from bookmarks in current file
:Telescope vim_bookmarks current_file

Lua equivalent:

require('telescope').extensions.vim_bookmarks.all()
require('telescope').extensions.vim_bookmarks.current_file()

Customization

Both pickers take a table of options that you can use to customize them. Here's a list of available options along with their default values:

OptionExplanationDefault Value
hide_filenameWhether to display the filename of bookmarks in the pickertrue for all, false for current_file
tail_pathIf true, display only the filename, otherwise display the full pathSame as your global telescope config
shorten_pathWhether to shorten the file path, works the same as with telescope's builtin pickers. (Only has an effect when tail_path=false)true
prompt_titleTitle of the search prompt'vim-bookmarks'
width_lineWidth reserved for the line number in the picker5
width_textWidth reserved for the bookmark text in the picker60
only_annotatedOnly display bookmarks that have an annotationfalse
attach_mappingsSee following section{}

Additionally, the table of options is passed on to your configured qflist_previewer and generic_sorter (See Telescope docs for details)

Actions

The extension also provides custom actions for managing bookmarks:

ActionExplanation
delete_at_cursorDeletes the bookmark at current cursor position
delete_selectedDeletes all bookmarks selected via Telescope's multi-selection
delete_selected_or_at_cursorIf there's a multi selection, delete those bookmarks, otherwise delete the one at the curso position
delete_allDeletes all bookmarks (Same as :BookmarkClearAll)

For example:

local bookmark_actions = require('telescope').extensions.vim_bookmarks.actions
require('telescope').extensions.vim_bookmarks.all {
    attach_mappings = function(_, map) 
        map('n', 'dd', bookmark_actions.delete_selected_or_at_cursor)

        return true
    end
}