/telescope-bookmarks.nvim

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

Primary LanguageLuaMIT LicenseMIT

telescope-bookmarks.nvim

Requires Neovim Requires Telescope GitHub release (latest SemVer) 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 on the respective OS:

Browser Operating System
MacOS Linux Windows
Google Chrome ☑️ ☑️ ☑️
Google Chrome Beta ☑️ ☑️ ☑️
Brave ☑️ ☑️ ☑️
Safari [1] ☑️ - -
Firefox ☑️ ☑️ ☑️
Microsoft Edge ☑️ ☑️ ☑️

Supported tools:

  • buku - bookmark manager

Please take a look at the Caveats section if you're planning to use this plugin with Safari.

Requirements

Installation

Using packer.nvim

use {
  'dhruvmanila/telescope-bookmarks.nvim',
  -- Uncomment if the selected browser is Firefox
  -- requires = {
  --   'tami5/sqlite.lua',
  -- }
}

Using vim-plug

Plug 'dhruvmanila/telescope-bookmarks.nvim'
" Uncomment if the selected browser is Firefox
" Plug 'tami5/sqlite.lua'

Telescope Config

Loading the extension:

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

Extension options:

require('telescope').setup {
  extensions = {
    bookmarks = {
      -- Available: 'brave', 'buku', 'chrome', 'chrome_beta', 'edge', 'safari', 'firefox'
      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 Firefox
      firefox_profile_name = nil,
    },
  }
}

For Firefox users, the default profile will be used if firefox_profile_name is not provided. This is obtained by parsing the profiles config file present in the default config directory.

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:

Available Commands

" From the command-line
Telescope bookmarks

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

When you press <CR> on a selected bookmark, it will open the URL using either the url_open_plugin or url_open_command option in your default browser.

Caveats

Safari

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. Please take a look at the below image for more details:

Allow full disk access to the application running neovim (iTerm2) Full disk access settings

References