Giter VIP home page Giter VIP logo

google-search's Introduction

Google Search

Search Google for the currently selected text/word, or an input in Sublime Text 2/3.

This package adds:

  • A Google Search command to the context menu for the selected
  • A pallete command for the current selection(or word)
  • A pallete command that will ask you what to search

Install

If your using the Sublime Package Manager hold down Ctrl+Shift+P and type Package Control: Install Package. Then search for google-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/nwjlyons/google-search.git.

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

Settings

{
    "suffix": "", // will be after the query
    "prefix": "", // will be added before the query
    "default_browser": "", // chrome, firefox, more valid values here https://docs.python.org/2/library/webbrowser.html#webbrowser.register
    "domain": "https://www.google.com" // google domain to perform the search
}

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

Usage

Place the cursor inside a word or select some text and press Ctrl+Shift+G.

Context Menu context menu

Command Pallette

pallete

pallete

google-search's People

Contributors

mihai-vlc avatar nwjlyons avatar zeragamba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

google-search's Issues

Support double quotes ("") and other special characters, potential fix included

The plugin breaks when given search strings including quote characters, e.g.
search this "and this"

A potential fix would be to convert the query to URL format (substituting special characters) by using urllib like so:

import webbrowser
from urllib.parse import quote_plus         # <--- added
import sublime, sublime_plugin


def search(q):
    settings = sublime.load_settings("google_search.sublime-settings")
    # Attach the suffix and the prefix
    q = quote_plus(settings.get('prefix', '') + q + settings.get('suffix', ''))    # <--- changed

    fullUrl = settings.get('domain', 'https://www.google.com') + "/search?q=%s" % q

    webbrowser.open(fullUrl)

Feature request: Affix file type name

Could you tell me if there is a way to affix the file type name to the Google searches? For example, if I'm working on a .py file in Sublime Text and I highlight some text and use your google-search package, I want it to do a search for the highlighted text with " python" included automatically (same with ".php" and " php", etc...)

NOT INSTALLING

Sublime Text 3211 (also ST4-drag-drop-flop)
MacOS 11.4 MacPro 2018
PackageControl is not installing Google Search.
Just to be sure, can select to install Google Search.
PackageControl: Install Package - Google Search is there, select nothing happens.
/Users/.../Library/Application Support/Sublime Text 3/Installed Packages ...nothing.
/Users/.../Library/Application Support/Sublime Text 3/Packages/User/Package Control.sublime-settings ...nothing.
PackageResourceViewer confirms that Google Search is not installed.
PackageControl is not installing Google Search.

webbrowser not open default browser

Hi,
in mac os sierra, the webbrowser not open default browser.
You could add an option to select the browser to be used, such as:

    try:
        browser = settings.get('browser', '')
        webbrowser.get(browser).open(fullUrl)
    except:
        webbrowser.open(fullUrl)

thanks

Note: sublime text open url, has the same error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.