Is there something similar in Vim?


Thanks in advance!


To complement @laktak's answer, the author of the 'tyru/open-browser' plugin recommends the following maps:

nmap gx <Plug>(openbrowser-smart-search)
vmap gx <Plug>(openbrowser-smart-search)

@laktak's suggestion of mapping <F1> works, but why use a function key when you can keep your fingers on home row? :)

After installing the plugin, and putting these maps in your .vimrc, you should be able to press gx to automatically open your default browser and search Google for the either the word under the cursor (in normal mode) or all the text included in your visual selection (in visual mode). If you already have an instance of your default browser open, a new tab will be opened..

It works great. There are even options to change the browser and search engine used.

| improve this answer | |

Install 'tyru/open-browser.vim'

And add the map:

map <F1> <Plug>(openbrowser-search)

This will allow you to search the word under the cursor or your selection.

| improve this answer | |
  • Could you tell me how to map the Google to obtain the same feature with F1 ? – user11452 Mar 4 '17 at 16:05
  • I would like to highlight the text and then execute Google. It follows that we make a google research a specific word or group of words. Could you tell me how I can do that. – user11452 Mar 4 '17 at 18:15
  • @davidlabrecque see update – laktak Mar 4 '17 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy