Skip to content

Latest commit

 

History

History
207 lines (157 loc) · 6.65 KB

README.md

File metadata and controls

207 lines (157 loc) · 6.65 KB

telescope-bookmarks.nvim

test codecov GitHub release License

A Neovim Telescope extension to open your browser bookmarks right from the editor!

telescope-bookmarks.nvim

Screenshot configuration
require('telescope').extensions.bookmarks.bookmarks(
  require('telescope.themes').get_dropdown {
    layout_config = {
      width = 0.8,
      height = 0.8,
    },
    previewer = false,
  }
)

Supported browsers

Browser MacOS Linux Windows
Brave ☑️ ☑️ ☑️
Brave Beta ☑️ ☑️ ☑️
Google Chrome ☑️ ☑️ ☑️
Google Chrome Beta ☑️ ☑️ ☑️
Microsoft Edge ☑️ ☑️ ☑️
Firefox ☑️ ☑️ ☑️
qutebrowser ☑️ ☑️ ☑️
Safari 1 ☑️ - -
Vivaldi ☑️ ☑️ ☑️
Waterfox ☑️ ☑️ ☑️

Supported tools

  • buku - bookmark manager

Requirements

Requires Neovim

Neovim version requirement is the same as that of telescope.nvim.

Installation

The project follows semantic versioning, so it's recommended to specify the tag when installing. The latest released version can be found here.

The plugin managers mentioned below supports wildcard (*) in the tag key which points to the latest git tag. You can specify a specific version if you'd prefer to inspect the changes before updating.

use {
  'dhruvmanila/telescope-bookmarks.nvim',
  tag = '*',
  -- Uncomment if the selected browser is Firefox, Waterfox or buku
  -- requires = {
  --   'kkharji/sqlite.lua',
  -- }
}

Using vim-plug

Plug 'dhruvmanila/telescope-bookmarks.nvim', { 'tag': '*' }
" Uncomment if the selected browser is Firefox, Waterfox or buku
" Plug 'kkharji/sqlite.lua'

Usage

To get started, simply load the extension:

require('telescope').load_extension('bookmarks')

You can open the picker either from the command-line or calling the lua function:

" From the command-line
Telescope bookmarks

" Using lua function
lua require('telescope').extensions.bookmarks.bookmarks(opts)

Telescope can lazily load the extension when needed, but that can only be called using the lua function. The command-line argument will not work as the extension is not yet loaded.

When you press Enter on a selected bookmark, it will open the URL using either the url_open_plugin or url_open_command option in your default browser. Multiple bookmarks can be opened at the same time using multi selections feature in Telescope.

Configuration

Extension options:

Note

These are the default values for all the available options. You don't need to set them in your config. Just pick the ones whose value you would want to change and add it to your config.

require('telescope').setup {
  extensions = {
    bookmarks = {
      -- Available:
      --  * 'brave'
      --  * 'brave_beta'
      --  * 'buku'
      --  * 'chrome'
      --  * 'chrome_beta'
      --  * 'edge'
      --  * 'firefox'
      --  * 'qutebrowser'
      --  * 'safari'
      --  * 'vivaldi'
      --  * 'waterfox'
      selected_browser = 'brave',

      -- Either provide a shell command to open the URL
      url_open_command = 'open',

      -- Or provide the plugin name which is already installed
      -- Available: 'vim_external', 'open_browser'
      url_open_plugin = nil,

      -- Show the full path to the bookmark instead of just the bookmark name
      full_path = true,

      -- Provide a custom profile name for the selected browser
      -- Supported browsers:
      --  * 'brave'
      --  * 'brave_beta'
      --  * 'chrome'
      --  * 'chrome_beta'
      --  * 'edge'
      --  * 'firefox'
      --  * 'vivaldi'
      --  * 'waterfox'
      profile_name = nil,

      -- Add a column which contains the tags for each bookmark for buku
      buku_include_tags = false,

      -- Provide debug messages
      debug = false,
    },
  }
}

For browsers which supports specifying profiles, the default profile will be used if profile_name is not provided.

If the user has provided url_open_plugin then it will be used, otherwise default to using url_open_command. Supported plugins for url_open_plugin and the respective plugin function used to open the URL:

Contributing

Contributions are always welcome and highly appreciated. Refer to the Contributing Guidelines.

References

Footnotes

  1. The application which is used to run neovim should be allowed full disk access as the bookmarks file (~/Library/Safari/Bookmarks.plist) is in a restricted directory. This can be done in System Preferences > Security & Privacy > Full Disk Access and then click on the checkbox next to your preferred application.