This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+web-services/search-engine/README.org

105 lines
3.4 KiB
Org Mode
Raw Normal View History

#+TITLE: Search Engine layer
2015-06-10 16:44:30 +00:00
2019-05-02 21:49:30 +00:00
#+TAGS: layer|web service
2015-06-10 16:44:30 +00:00
[[file:img/searchengine.jpg]]
2019-05-07 20:05:06 +00:00
* Table of Contents :TOC_5_gh:noexport:
2017-05-22 14:16:12 +00:00
- [[#description][Description]]
- [[#features][Features:]]
- [[#supported-search-engines][Supported search engines]]
2017-05-22 14:16:12 +00:00
- [[#install][Install]]
- [[#key-bindings][Key bindings]]
2017-05-22 14:16:12 +00:00
- [[#customize-it][Customize it!]]
2015-06-10 16:44:30 +00:00
* Description
2017-04-25 15:42:58 +00:00
This layer adds support for the [[https://github.com/hrs/engine-mode][Search Engine]] package.
2015-06-10 16:44:30 +00:00
** Features:
2018-09-19 03:54:47 +00:00
- Browser search integration
2019-04-21 19:00:24 +00:00
* Supported search engines
2015-06-10 16:44:30 +00:00
- Amazon
- Bing
2015-06-10 16:44:30 +00:00
- Duck Duck Go
- Ecosia
2015-06-10 16:44:30 +00:00
- Google
- Google Images
- GitHub
- Google Maps
- Twitter
- Project Gutenberg
- YouTube
2015-06-10 16:44:30 +00:00
- Stack Overflow
- Spacemacs Issues
- Spacemacs Pull Requests
2015-06-10 16:44:30 +00:00
- Wikipedia
- Wolfram Alpha
- Maven Central
- Npm
- Hoogle 5
- Hackage Package Search
- Clojure-doc
- Python Package Index
- Python Docs
- C++ Reference
- Melpa
- Debian Packages
- Ubuntu Packages
2015-06-10 16:44:30 +00:00
* Install
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
add =search-engine= to the existing =dotspacemacs-configuration-layers= list in this
file.
* Key bindings
2015-06-10 16:44:30 +00:00
| Evil | Holy | Command |
|-------------+---------+-------------------------------------------|
| ~SPC a w /~ | ~C-c /~ | Summon a Helm buffer to select any engine |
2015-06-10 16:44:30 +00:00
* Customize it!
If you'd rather have emacs use chrome, or firefox or any other thing (=eww=) you
2015-06-10 16:44:30 +00:00
can have that customization. For example for google chrome you can put this in
your =dotspacemacs/user-config=:
2015-06-10 16:44:30 +00:00
#+BEGIN_SRC emacs-lisp
(setq browse-url-browser-function 'browse-url-generic
engine/browser-function 'browse-url-generic
browse-url-generic-program "google-chrome")
#+END_SRC
The Amazon search engine defaults to use the =.com= [[https://en.wikipedia.org/wiki/TLD][TLD]]. If you want it to search on
another country's website, you can specify a different one:
#+BEGIN_SRC emacs-lisp
;; Use amazon.es site (Spain)
(setq-default search-engine-amazon-tld "es")
#+END_SRC
If you want more control of how various search engines are handled
or you want to add additional ones you can do so by setting the
following datastructure to =search-engine-config-list= in your =dotspacemacs/user-config=.
The datastructure consists of a key and:
- name -> the name displayed in the search prompt.
- url -> the url to query against, search parameter must be set as =%s=.
- keywords -> a list of =engine-mode= keywords like a specific browser to use
or a specific transformation to make. You can find a detailed
list of all supported features [[https://github.com/hrs/engine-mode][here]].
2015-06-10 16:44:30 +00:00
#+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-configuration-layers
'((search-engine :variables
search-engine-config-list '((custom1
:name "Custom Search Engine 1"
:url "http://www.domain.com/s/stuff_sutff_remember_to_replace_search_candidate_with_%s"
:keywords (:docstring "My custom string"
:browser 'eww-browse-url))))))
2015-06-10 16:44:30 +00:00
#+END_SRC
If you'd rather not use helm but would want a specific search engine, remember
2015-06-10 16:44:30 +00:00
the function generated is always =engine/search-(the name of the search engine
lower-case and hyphen instead-of-spaces-for-separation)= so you can bind that to
any key binding you want.