2017-06-08 11:47:56 +02:00
|
|
|
;;; feature/jump/autoload/evil.el -*- lexical-binding: t; -*-
|
2017-05-21 15:06:15 +02:00
|
|
|
|
|
|
|
;;;###autoload (autoload '+jump:online "feature/jump/autoload/evil" nil t)
|
|
|
|
(evil-define-command +jump:online (query &optional bang)
|
2017-05-21 15:08:20 +02:00
|
|
|
"Look up QUERY online. Will prompt for search engine the first time, then
|
|
|
|
reuse it on consecutive uses of this command. If BANG, always prompt for search
|
|
|
|
engine."
|
2017-05-21 15:06:15 +02:00
|
|
|
(interactive "<a><!>")
|
2017-06-08 11:47:56 +02:00
|
|
|
(let ((query (or query (thing-at-point 'symbol t))))
|
|
|
|
(unless query
|
|
|
|
(user-error "The search query is empty"))
|
|
|
|
(+jump/online
|
|
|
|
(or (and (not bang) (bound-and-true-p +jump--online-last))
|
|
|
|
(completing-read (format "Search on (%s): " query)
|
|
|
|
(mapcar #'car +jump-search-url-alist)
|
|
|
|
nil t))
|
|
|
|
query)))
|