sponsor Vim development Vim logo Vim Book Ad

open-browser.vim : Open URI with your favorite browser from your most favorite editor

 script karma  Rating 42/15, Downloaded by 2983  Comments, bugs, improvements  Vim wiki

created by
script type

" This is my setting.
let g:netrw_nogx = 1 " disable netrw's gx mapping.
nmap gx <Plug>(openbrowser-smart-search)
vmap gx <Plug>(openbrowser-smart-search)

" Open URI under cursor.
nmap map-you-like <Plug>(openbrowser-open)
" Open selected URI.
vmap map-you-like <Plug>(openbrowser-open)

" Search word under cursor.
nmap map-you-like <Plug>(openbrowser-search)
" Search selected word. vmap map-you-like <Plug>(openbrowser-search)

" If it looks like URI, Open URI under cursor.
" Otherwise, Search word under cursor.
nmap map-you-like <Plug>(openbrowser-smart-search)
" If it looks like URI, Open selected URI.
" Otherwise, Search selected word.
vmap map-you-like <Plug>(openbrowser-smart-search)

" In command-line
:OpenBrowser http://google.com/
:OpenBrowserSearch ggrks
:OpenBrowserSmartSearch http://google.com/
:OpenBrowserSmartSearch ggrks


We have tested on these environments.
- Ubuntu 9.10 GNOME
- Windows XP
- Cygwin
- Mac OS X

Thanks for testing:
- mfumi (Mac OS X)
- iicebar (Windows XP)

install details
unzip zip file, and move them to ~/.vim or ~/vimfiles (Windows).

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
open-browser-v2.0.0.zip 2.0.0 2018-03-11 7.4 tyru * [Fix] Vim hangs until a browser exits (close #68)
* [Feature] Add DevDocs to search engines (#69)
* [Feature] Open multiple URLs when selecting in visual-mode (#70)
* [Feature] If there are no words on cursor, find next URL after cursor. (#71)
* [Fix] Allow the url without dots like http://localhost/ (#80)
* [Fix] ':OpenBrowser' won't open '' (#82)
* [Feature] Support MSYS2 (fix #92)
* [Feature] Support Windows Subsystem for Linux (#105)
* [Feature] Add fileformat.info as search engine
* [Feature] Write internal code as vim-jp/vital.vim modules; easily reuseable as Vim script library (vital is embeddable library and mechanism: it provides node_modules directory for Node.js, or vendor directory for Go) (#113)
* More many improvements and bugfixes
NOTE: this is the final release for Vim 7.4 support.
open-browser.vim-0.1.1.zip 0.1.1 2015-02-28 7.0 tyru - Avoid hit-enter-prompt when opening URL
- Add English/Japanese menus
- Allow to disable the default search engines
- Add g:openbrowser_short_message
- Improve URI/URL handling
- Improve vimproc.vim integration
- Improve open-browser-github.vim integration
- Improve ghq command integration
- Change structure of g:openbrowser_browser_commands
- Remove g:openbrowser_{isfname,iskeyword}
- ...and fixed many many problems...
openbrowser.zip 0.0.7 2011-12-01 7.0 tyru - Support some search engines (alphabetically)
  Most search engines were suggested by stardiviner, thanks!
  - Ask Ubuntu
  - Baidu
  - Blekko
  - CPAN (search.cpan.org)
  - DuckDuckGo
  - GitHub
  - Google Code (en)
  - PHP (www.php.net)
  - Python (docs.python.org)
  - Twitter Search
  - Twitter (user)
  - VeryCD
  - Wikipedia (en)
  - vim.org
- Fix bug: command-line completion did not return all matched search engines,
  it returned only first matched search engine.
- Fix bug: if the key contains "-" in g:openbrowser_search_engines,
  it does not work.
- Change s:expand_keyword() syntax. It recognizes only {vim expression}.
  (see :help openbrowser-option-syntax for details)
  - Change default value of g:openbrowser_open_rules
  - Change default value of g:openbrowser_search_engines
openbrowser.zip 0.0.6a 2011-11-27 7.0 tyru - Allow b:option, w:option, t:option not only g:option.
- Fix Mac OS X environment detection.
  (Thanks Chomo for the report. and sorry to forget including your name in 0.0.6 changelog. I've uploaded again.)
- Fix the problem that open-browser.vim does not work on cygwin.
  (Thanks toooooooby for the patch. and sorry to forget including your name in 0.0.6 changelog. I've uploaded again.)
openbrowser.zip 0.0.5 2011-06-30 7.0 tyru (NOTE: Next release will break some backward compatibility, maybe)
- Document fix/improvement
- Add :command-completion to :OpenBrowserSmartSearch.
- :OpenBrowserSmartSearch: allow {search-engine} option
  like :OpenBrowserSearch
- Minor bug fixes
openbrowser.zip 0.0.4 2011-06-21 7.0 tyru - Improve |:OpenBrowserSearch| completion
- Add <Plug>(openbrowser-search)
- Add <Plug>(openbrowser-smart-search)
- Merge Daniel Hahler's branch. thanks!
- Spawn a browser in background
  - This fixes freezing when spawning a browser
- Change |g:openbrowser_fix_schemes| default value
  - Add pair: "ttps" => "https"
- etc.
openbrowser.zip 0.0.3 2011-03-09 7.0 tyru - Implement g:openbrowser_default_search.
- Implement g:openbrowser_search_engines.
- Implement g:openbrowser_open_filepath_in_vim.
- Implement g:openbrowser_open_vim_command.
- Separate plugin/openbrowser.vim to autoload/openbrowser.vim to save the memory.
- Bundle urilib.vim (autoload/urilib.vim)
- Fix bug: openbrowser should open URI which has no scheme
  (e.g.: example.com)
openbrowser.zip 0.0.2 2010-06-28 7.0 tyru - Rename |g:openbrowser_isfname| to |g:openbrowser_iskeyword|.
variable |g:openbrowser_isfname| is still available for
backward compatibility.
- Specialize |g:openbrowser_iskeyword| value to get URI in <cword>.
- More readable messages.
openbrowser.zip 0.0.1 2010-06-27 7.0 tyru - Support opening file path.
- Fix minor bugs.
openbrowser.zip 0.0.0 2010-06-26 7.0 tyru Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
OSDN.net Logo