Skip to content
🌀 Perform a quick web search for the text selected in (Neo)Vim
Vim script
Branch: master
Clone or download
Latest commit b417e28 Dec 31, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
autoload
doc Refactor Dec 28, 2019
plugin Refactor Dec 28, 2019
.gitignore chore: optimize May 21, 2019
.travis.yml Add syntax testing Dec 31, 2019
LICENSE chore: Create LICENSE Mar 19, 2019
README.md Add syntax testing Dec 31, 2019

README.md

vim-browser-search

Build Status

This plugin helps perform a quick web search for the text selected in (Neo)Vim

Installation

Plug 'voldikss/vim-browser-search'

Keymappings

This plugin doesn't supply any default mappings. Here are some recommended key mappings

nmap <silent> <Leader>s <Plug>SearchNormal
vmap <silent> <Leader>s <Plug>SearchVisual

Use cases

  • Select text and type <Leader>s to do a web search

  • Type <Leader>saw in to search web for a word

  • Type <Leader>sa( to search web for the text wrapped in the bracket

  • Type <Leader>sas to search web for a sentence

  • ...

Variables

g:browser_search_default_engine

Defaut: 'google'

g:browser_search_engines

Defaut:

  {
  \ 'google':'https://google.com/search?q=%s',
  \ 'github':'https://github.com/search?q=%s',
  \ 'stackoverflow':'https://stackoverflow.com/search?q=%s',
  \ 'bing': 'https://www.bing.com/search?q=%s',
  \ 'duckduckgo': 'https://duckduckgo.com/?q=%s',
  \ 'wikipedia': 'https://en.wikipedia.org/wiki/%s',
  \ 'youtube':'https://www.youtube.com/results?search_query=%s&page=&utm_source=opensearch',
  \ 'baidu':'https://www.baidu.com/s?ie=UTF-8&wd=%s'
  \ }

Commands

:Search {engine} {text}

Search text with engine

:SearchCurrentText [engine]

Search the text under the cursor with engine, if no engine, use g:browser_search_default_engine

:SearchVisualText [engine]

Search the selected text with engine, if no engine, use g:browser_search_default_engine

You can’t perform that action at this time.