- cross platform
- reduces your search key strokes for any stackoverflow query
- devdocs search
- MDN search
- neovim (0.7.0+)
- telescope.nvim
- open cmd
- dressing.nvim it will make the inputs and selects pretty (optional)
-
{ "lalitmee/browse.nvim", dependencies = { "nvim-telescope/telescope.nvim" }, }
-
use({ "lalitmee/browse.nvim", requires = { "nvim-telescope/telescope.nvim" }, })
-
Plug 'nvim-telescope/telescope.nvim' Plug 'lalitmee/browse.nvim'
-- default values for the setup
require('browse').setup({
-- search provider you want to use
provider = "google", -- duckduckgo, bing
-- either pass it here or just pass the table to the functions
-- see below for more
bookmarks = {},
icons = {
bookmark_alias = "->", -- if you have nerd fonts, you can set this to ""
bookmarks_prompt = "", -- if you have nerd fonts, you can set this to " "
grouped_bookmarks = "->", -- if you have nerd fonts, you can set this to
}
-- if you want to persist the query for grouped bookmarks
-- See https://github.com/lalitmee/browse.nvim/pull/23
persist_grouped_bookmarks_query = false,
})
There are so many ways in which you can use this to improve your search experience. After bookmarks
table support for multiple formats and organized structure of the bookmarks, you can just use open_bookmarks()
api.
For bookmarks you can declare your bookmarks in lua table format. bookmarks
table can contain multiple structures.
-
grouped urls with a name key in the table (recommended)
local bookmarks = { ["github"] = { ["name"] = "search github from neovim", ["code_search"] = "https://github.com/search?q=%s&type=code", ["repo_search"] = "https://github.com/search?q=%s&type=repositories", ["issues_search"] = "https://github.com/search?q=%s&type=issues", ["pulls_search"] = "https://github.com/search?q=%s&type=pullrequests", }, }
-
urls with aliases
local bookmarks = { ["github_code_search"] = "https://github.com/search?q=%s&type=code", ["github_repo_search"] = "https://github.com/search?q=%s&type=repositories", }
-
urls with a query parameter
local bookmarks = { "https://github.com/search?q=%s&type=code", "https://github.com/search?q=%s&type=repositories", }
-
simple and direct urls
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", }
-
you can also combine all of the above in a table if you want.
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.
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.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.search()
, search for anything on MDN
require('browse.mdn').search()
You can customize the input_search()
to use the provider
you like. Possible values for the provider are following:
google
duckduckgo
brave
bing
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("InputSearch", function()
browse.input_search()
end, {})
-- this will open telescope using dropdown theme with all the available options
-- in which `browse.nvim` can be used
command("Browse", function()
browse.browse({ bookmarks = bookmarks })
end)
command("Bookmarks", function()
browse.open_bookmarks({ bookmarks = bookmarks })
end)
command("DevdocsSearch", function()
browse.devdocs.search()
end)
command("DevdocsFiletypeSearch", function()
browse.devdocs.search_with_filetype()
end)
command("MdnSearch", function()
browse.mdn.search()
end)