browse.nvim
browse.nvim copied to clipboard
browse for anything using your choice of method
Features
- cross platform
- reduces your search key strokes for any stackoverflow query
- devdocs search
- MDN search
Requirements
- neovim (0.7.0+)
- telescope.nvim (if you want to browse bookmarks otherwise no need)
- xdg-open (linux)
- open (mac)
- start (windows)
- dressing.nvim it will make the inputs and selects pretty (optional)
Installation
-
use({ "lalitmee/browse.nvim", requires = { "nvim-telescope/telescope.nvim" }, })
-
Plug 'nvim-telescope/telescope.nvim' Plug 'lalitmee/browse.nvim'
Usage
browse.nvim
exposes the following for:
Search
-
input_search()
, it will prompt you to search for something
require('browse').input_search()
-
open_bookmarks()
, search with the tablebookmarks
require("browse").open_bookmarks({ bookmarks = bookmarks })
-
browse()
, it openstelescope.nvim
dropdown theme to select the method
require("browse").browse({ bookmarks = bookmarks })
devdocs
-
devdocs.search()
, search for anything in the devdocs
require('browse.devdocs').search()
-
devdocs.search_with_filetype()
, search for anything for the current file type
require('browse.devdocs').search_with_filetype()
MDN
-
mdn.search()
, search for anything on MDN
require('browse.mdn').search()
bookmarks
For bookmarks you can declare your bookmarks in lua table format. for example:
local bookmarks = {
"https://github.com/hoob3rt/lualine.nvim",
"https://github.com/neovim/neovim",
"https://neovim.discourse.group/",
"https://github.com/nvim-telescope/telescope.nvim",
"https://github.com/rockerBOO/awesome-neovim",
}
and then pass this table into the browse()
function like this
vim.keymap.set("n", "<leader>b", function()
require("browse").browse({ bookmarks = bookmarks })
end)
If this
bookmarks
table will be empty or will not be passed and if you selectBookmarks
fromtelescope
result, you will not see anything in the telescope results.
Customizations
You can customize the input_search()
to use the provider
you like. Possible values for the provider are following:
-
google
-
duckduckgo
-
brave
-
bing
require('browse').setup({
-- search provider you want to use
provider = "google", -- default
})
Advanced usage
Create commands for all the functions which browse.nvim
exposes and then simply run whatever you want from the
command line
local browse = require('browse')
function command(name, rhs, opts)
opts = opts or {}
vim.api.nvim_create_user_command(name, rhs, opts)
end
command("BrowseInputSearch", function()
browse.input_search()
end, {})
command("Browse", function()
browse.browse({ bookmarks = bookmarks })
end, {})
command("BrowseBookmarks", function()
browse.open_bookmarks({ bookmarks = bookmarks })
end, {})
command("BrowseDevdocsSearch", function()
browse.devdocs.search()
end, {})
command("BrowseDevdocsFiletypeSearch", function()
browse.devdocs.search_with_filetype()
end, {})
command("BrowseMdnSearch", function()
browse.mdn.search()
end, {})
Acknowledgements and Credits
Donate
Buy me a coffee through paypal.