browser-bookmarks.nvim
browser-bookmarks.nvim copied to clipboard
A Neovim plugin to open your browser bookmarks right from the editor!
telescope-bookmarks.nvim
A Neovim Telescope extension to open your browser bookmarks right from the editor!
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 | ☑️ | ☑️ | ☑️ |
Vivaldi | ☑️ | ☑️ | ☑️ |
Supported tools:
- buku - bookmark manager
Please take a look at the Caveats section if you're planning to use this plugin with Safari.
Requirements
- telescope.nvim
- sqlite.lua (only for Firefox browser and buku)
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.
Using packer.nvim
use {
'dhruvmanila/telescope-bookmarks.nvim',
tag = '*',
-- Uncomment if the selected browser is Firefox or buku
-- requires = {
-- 'kkharji/sqlite.lua',
-- }
}
Using vim-plug
Plug 'dhruvmanila/telescope-bookmarks.nvim', { 'tag': '*' }
" Uncomment if the selected browser is Firefox 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:
require('telescope').setup {
extensions = {
bookmarks = {
-- Available: 'brave', 'buku', 'chrome', 'chrome_beta', 'edge', 'safari', 'firefox', 'vivaldi'
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,
-- Add a column which contains the tags for each bookmark for buku
buku_include_tags = false,
-- Provide debug messages
debug = false,
},
}
}
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:
-
open-browser.vim -
openbrowser#open
-
vim-external -
external#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](https://user-images.githubusercontent.com/67177269/115988185-16db7e80-a5d6-11eb-9667-f37bb288bfa8.png)