Giter VIP home page Giter VIP logo

emacs-quick-search's Introduction

Quick Search

The purpose of this package is to facilitate searching things on the web directly from Emacs (without needing to resort to eww). You can customize specific search engines for specific modes (and even set engines globally).

Demonstration:

demonstration.mp4

Installation

Simply copy quick-search.el's source code into your init.el. After that, you can add the configuration code.

Configuration

There are 2 function that you need to set up in order to use quick-search

Preferred browser

quick-search/set-preferred-browser configures your browser of choice. It has two arguments:

  1. Your preferred browser's name
  2. Any command line arguments you'd like to pass

Examples:

  • (quick-search/set-preferred-browser "firefox" "")
  • (quick-search/set-preferred-browser "chromium" "--incognito")

Search engines

quick-search/add-search-engine adds a search engine to the search engine list. It has 3 arguments:

  1. The name of the search engine
  2. Search engine link (normally found on the URL of websites after searching for something)
  3. A quoted list of modes you'd like the search engine to be enabled in. Write nil if you'd like to enable it globally. Examples:
  • (quick-search/add-search-engine "Google" "https://google.com/search?q=" nil)
  • (quick-search/add-search-engine "YouTube" "https://www.youtube.com/results?search_query=" '(elisp-mode js-mode rust-mode))
  • (quick-search/add-search-engine "C plus plus" "https://cplusplus.com/search.do?q=" '(c++-mode c-mode))

Usage

Simply call the quick-search function after having it configured (you need to have a selected browser and at least 1 search engine)

Example configuration

; This sets firefox as the default browser with no extra arguments
(quick-search/set-preferred-browser "firefox" "")

; Adds google search engine to be enabled in all the modes
(quick-search/add-search-engine "Google" "https://google.com/search?q=" nil)

; Same thing as above but for Wikipedia
(quick-search/add-search-engine "Wikipedia" "https://en.wikipedia.org/w/index.php?search=" nil)

; Enables the python documentation for Python mode
(quick-search/add-search-engine "Python" "https://docs.python.org/3/search.html?q=" '(python-mode))

; Enables C Plus Plus website for both C and C++ mode
(quick-search/add-search-engine "C plus plus" "https://cplusplus.com/search.do?q=" '(c++-mode c-mode))

; Enables oxford dictionary for "Writing" modes
(quick-search/add-search-engine "Oxford Dictionary" "https://www.oxfordlearnersdictionaries.com/definition/english/" '(org-mode latex-mode LaTeX-mode tex-mode markdown-mode))

; Disable the async shell command window. Source: https://emacs.stackexchange.com/a/58341/39379
(add-to-list 'display-buffer-alist '("*Async Shell Command*" display-buffer-no-window (nil)))

You can even add the function to a keybinding.

(global-set-key "\C-c\C-s" 'quick-search)

evil-leader users can also do the following:

(evil-leader/set-key "s" 'quick-search)

Credits

  • Thanks to @heemayl for the original foundation. Check out their website
  • Thanks to Trey Jackson for this stackoverflow answer. Check out their website. If anyone can find his GitHub profile, please make a PR.
  • Thank you NickD for this stackoverflow answer.

Disclaimer

I am not affiliated with any of the search engines/browsers mentioned. Other options are available

emacs-quick-search's People

Contributors

lima-limon-inc avatar heemayl avatar

Watchers

 avatar

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.