vim-websearch


Ⅰ. 插件描述

trigger a web search from within vim

Ⅱ. 基本信息

创建日期:  2015-01-05
使用用户:  3
Github星:  2
插件作者:  Lukas Singer

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'linluk/vim-websearch'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'linluk/vim-websearch'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'linluk/vim-websearch'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/linluk/vim-websearch

Ⅳ. 文档说明

vim-websearch

vim-websearch allows you to trigger a web search from within vim.
you can search for the word under the cursor, for a visual selection or for something you type.

Configuration

variables:

variable namepossible valuesinfo
g:web_search_engine"google", "duckduck"choose your search engine. default: "duckduck"
g:web_search_queryany stringif set g:web_search_engine has no effect. your search term will be added to this. no default.
g:web_search_browser"lynx", "chromium"choose your browser. default: "lynx"
g:web_search_commandany stringif set g:web_search_browser has no effect. your favorite browser. no default.
g:web_search_use_default_mapping"yes", anyif set to "yes" the default mappings get set. default: unset

the default is to search in duckduckgo with lynx.
to use f.e. firefox with yahoo put this in your .vimrc:

  let g:web_search_command = "firefox"
  let g:web_search_query = "https://search.yahoo.com/search;?p="

to use f.e. chromium with google put this in your .vimrc:

  let g:web_search_engine = "google"
  let g:web_search_browser = "chromium"

you can also combine you favorite browser with a known search engine and viceversa:

  let g:web_search_command = "w3m"
  let g:web_search_engine = "duckduck"

if you want to use the default mapping (which is <leader>ws to search for the word under the cursor in normal mode or to search for the selection in visual mode) add this to your .vimrc:

  let g:web_search_use_default_mapping = "yes"

otherwise you can create your own mappings like this:

  " search for word under cursor in normal mode
  nnoremap <leader>w :WebSearchCursor<CR>
  " search for selection in visual mode
  vnoremap <leader>w :WebSearchVisual<CR>

Usage

type :WebSearchAbout in normal mode to see the about dialog.

type :WebSearch hello world in normal mode to search for hello world.

type :WebSearchCursor in normal mode to search for the word under the cursor.

type :WebSearchVisual in visual mode to search for the selected text.

instead of typing :WebSearchCursor and :WebSearchVisual i would recommend to use the default or any other mapping.

Bugs? Features?

feel free to open an issue or send a pull request.

License

Copyright (C) 2015 Lukas Singer.
I use the GNU GPL v3.
See LICENSE for more info.

添加新评论