2015-12-02 14:23:39 +00:00
|
|
|
#+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]]
|
2017-09-03 18:42:17 +00:00
|
|
|
- [[#features][Features:]]
|
2019-04-21 20:04:25 +00:00
|
|
|
- [[#supported-search-engines][Supported search engines]]
|
2017-05-22 14:16:12 +00:00
|
|
|
- [[#install][Install]]
|
2018-12-05 03:03:03 +00:00
|
|
|
- [[#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
|
|
|
|
2017-09-03 18:42:17 +00:00
|
|
|
** Features:
|
2018-09-19 03:54:47 +00:00
|
|
|
- Browser search integration
|
2017-09-03 18:42:17 +00:00
|
|
|
|
2019-04-21 19:00:24 +00:00
|
|
|
* Supported search engines
|
2015-06-10 16:44:30 +00:00
|
|
|
- Amazon
|
2018-08-15 18:09:48 +00:00
|
|
|
- Bing
|
2015-06-10 16:44:30 +00:00
|
|
|
- Duck Duck Go
|
2018-08-15 18:09:48 +00:00
|
|
|
- Ecosia
|
2015-06-10 16:44:30 +00:00
|
|
|
- Google
|
|
|
|
- Google Images
|
|
|
|
- GitHub
|
|
|
|
- Google Maps
|
|
|
|
- Twitter
|
2018-08-15 18:09:48 +00:00
|
|
|
- Project Gutenberg
|
|
|
|
- YouTube
|
2015-06-10 16:44:30 +00:00
|
|
|
- Stack Overflow
|
|
|
|
- Spacemacs Issues
|
2018-08-15 18:09:48 +00:00
|
|
|
- Spacemacs Pull Requests
|
2015-06-10 16:44:30 +00:00
|
|
|
- Wikipedia
|
|
|
|
- Wolfram Alpha
|
2019-08-03 21:34:18 +00:00
|
|
|
- Maven Central
|
|
|
|
- Npm
|
2019-08-03 22:03:16 +00:00
|
|
|
- Hoogle 5
|
2019-08-04 14:32:45 +00:00
|
|
|
- Hackage Package Search
|
2019-08-03 22:03:16 +00:00
|
|
|
- Clojure-doc
|
2019-08-04 14:32:45 +00:00
|
|
|
- Python Package Index
|
|
|
|
- Python Docs
|
|
|
|
- C++ Reference
|
2020-11-09 22:27:33 +00:00
|
|
|
- Melpa
|
2021-03-23 23:55:39 +00:00
|
|
|
- Debian Packages
|
|
|
|
- Ubuntu Packages
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
* Install
|
2016-01-06 05:21:55 +00:00
|
|
|
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.
|
2016-04-13 03:31:38 +00:00
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
* Key bindings
|
2015-06-10 16:44:30 +00:00
|
|
|
|
2020-06-28 21:25:04 +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!
|
2019-05-26 20:58:52 +00:00
|
|
|
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
|
2015-09-28 06:05:18 +00:00
|
|
|
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
|
|
|
|
|
2021-04-12 15:59:12 +00:00
|
|
|
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:
|
2021-04-17 07:08:57 +00:00
|
|
|
|
2021-04-12 15:59:12 +00:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
;; Use amazon.es site (Spain)
|
|
|
|
(setq-default search-engine-amazon-tld "es")
|
|
|
|
#+END_SRC
|
|
|
|
|
2019-08-03 21:34:18 +00:00
|
|
|
If you want more control of how various search engines are handled
|
2019-07-31 18:32:20 +00:00
|
|
|
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=.
|
2019-08-03 21:34:18 +00:00
|
|
|
|
|
|
|
The datastructure consists of a key and:
|
2019-08-03 21:43:51 +00:00
|
|
|
- name -> the name displayed in the search prompt.
|
2019-07-31 18:32:20 +00:00
|
|
|
- url -> the url to query against, search parameter must be set as =%s=.
|
2019-08-03 21:43:51 +00:00
|
|
|
- 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
|
2019-07-31 18:32:20 +00:00
|
|
|
(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
|
|
|
|
|
2019-05-26 20:58:52 +00:00
|
|
|
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
|
2015-06-10 21:16:01 +00:00
|
|
|
any key binding you want.
|