A VIM plugin to open urls in the default browser
This plugin aim's is to provide a cross platform API to open a url in your default web browser.
:OpenURL <url>to open given url in the default web browser:OpenIn <browser> <url>to open given url in the specified web browser:OpenSearchURL <engine> <search terms>to search thesearch termsusing registered search engine.The default search engine is
duckduckgoHowever,google,stackoverflowandwikipediaare also available. You can change the default by settingg:open_url#engines#default.Search engines can be added using the API
open_url#engines#add(name, pattern)where name is a logical name and pattern is a string that represents the search url pattern, use%sas a placeholder for where the search term is added.:OpenURLFindto find a url ahead of the cursor on the same line and open it if found. NOTE: This also moves the cursor to the url when found.
These work in both normal mode and visual mode :
- gB: Open url under cursor in the default web browser.
- g<CR>: Search word under cursor using default search engine
- gG: Google search word under cursor in the default web browser
- gW: Wikipedia search word under cursor in the default web browser
The following plug mappings are provided which can be remapped if you prefer different mappings to those provided by default.
<Plug>(open-url-browser)<Plug>(open-url-search)<Plug>(open-url-search-so)<Plug>(open-url-search-google)<Plug>(open-url-search-wikipedia)
g:open_url_browser_defaultchanges default browser (Default:xdg-open)g:open_url_default_mappingsenable/disable default mappings without remapping<Plug>mappings (Default:1)
open_url#open(url): Open given url in the default web browseropen_url#open_in(app, url): Open url in specified application (only supported on mac osx).open_url#engines#add(name, pattern): Add a search engine to the list of existing search enginesopen_url#engines#search(engine, term): Search for giventermusing search engine namedengineopen_url#find_url(): Find and return a url (content beginning with http(s)) on the same line. Returns 0 if nothing found. NOTE: This also moves the cursor to the url when found.
Copyright © Dhruva Sagar. Distributed under the same terms as Vim itself.
See :help license.