bsoun / bang-search

Plugin to perform websearch from Sublime Text
MIT License
2 stars 0 forks source link

Bang Search

Version : 1.2.0

Change in behaviour for the input search method. If you enter a multiline search, using CTRL + ENTER between lines, a distinct browser's window is opened, one for each of your line in the input box panel.

Version : 1.1.2

Bug Correction

Version : 1.1.1

This plugin for Sublime Text 3 allow to perform a web search from the currently selected text/word or from an input panel from your predifined requests in one or several browser tabs.

Various custom or predefined search engine are declared in the bang-search.sublime-settings. You can add yours quite easily in this file , you can prefix your bang by whatever you want except for duckduckgo, this one must be valid : !...

There are several ways to perform your search :

This package adds:

Install

If your using the Sublime Package Manger hold down Ctrl+Shift+P and type Package Control: Install Package. Then search for bang-search and hit return.

If your not using the package manager then go to your Sublime packages directory(Sublime Text/Packages) Then run this command git clone https://github.com/bsoun/bang-search.git.

Or you can download the package as a zip file https://github.com/bsoun/bang-search/archive/master.zip then copy it into your Sublime packages directory.

SETTINGS

The two first parameters control the display options :

There are 4 types of request :

You can edit the settings by going to Preferences -> Package Settings -> Bang Search -> Settings - User

Browser configuration

The lib used to open a new tab is webbrowser.py. Only the first element of browsers_list will be used, the others are here to allow quick change in your configuration file. The "default" value refer to the None settings in webbrowser.py corresponding to the default browser.

THE FOLLOWING CONFIGURATION IS AT YOUR OWN RISK, let "default" if you have any doubt.

Identify already defined browsers by webbrowser.py

Open a console : View > Show console

And enter the following code to identify which browser you can use :

import webbrowser; print(webbrowser._browsers)

Register a browser in webbrowser.py

Open a console : View > Show console

And enter the following code to register a browser. Here is a sample for windows, you have to define an alias and the correct path to the choosed browser.

import webbrowser; webbrowser.register('google-chrome', None, webbrowser.BackgroundBrowser("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"))

Choose the browser for Bang-Search

In the bang_search.sublime-settings, place your default browser in first place in the list.

"browsers_list": ["firefox","default","google-chrome"],

Usage

Get the quick panel to choose your search query :

Use a personal key binding with args search-method: