summaryrefslogtreecommitdiff
path: root/.config/nyxt/commands.lisp
diff options
context:
space:
mode:
Diffstat (limited to '.config/nyxt/commands.lisp')
-rw-r--r--.config/nyxt/commands.lisp36
1 files changed, 19 insertions, 17 deletions
diff --git a/.config/nyxt/commands.lisp b/.config/nyxt/commands.lisp
index e89bea0..1739793 100644
--- a/.config/nyxt/commands.lisp
+++ b/.config/nyxt/commands.lisp
@@ -1,3 +1,5 @@
+(in-package #:nyxt-user)
+
(defvar *thanos/search-engines*
(list
'("google" "https://google.com/search?q=~a")
@@ -25,23 +27,23 @@ t if so and nil otherwise. The URL must not contain spaces."
Applies `func` to the query`.
Requires the variable `*thanos/search-engines*` for search queries."
(cond
- ((or (str:starts-with-p "localhost" query))
- (funcall func (str:concat "http://" query)))
- ((direct-url-p query)
- (funcall func (str:concat "https://" query)))
- ((str:starts-with-p "http" query)
- (funcall func query))
- ((let ((split-result (str:split #\Space query)))
- (find (first split-result) *thanos/search-engines* :key #'first :test #'string=))
- (let* ((engine-tag (subseq query 0 (position #\Space query)))
- (query (subseq query (+ 1 (position #\Space query))))
- (engine (find engine-tag *thanos/search-engines* :key #'first :test #'string=))
- (search-url (second engine)))
- (funcall func (cl-ppcre:regex-replace "~a" search-url (quri:url-encode query)))))
- (t
- (let* ((engine (first (last *thanos/search-engines*)))
- (search-url (second engine)))
- (funcall func (cl-ppcre:regex-replace "~a" search-url (quri:url-encode query)))))))
+ ((or (str:starts-with-p "localhost" query))
+ (funcall func (str:concat "http://" query)))
+ ((direct-url-p query)
+ (funcall func (str:concat "https://" query)))
+ ((str:starts-with-p "http" query)
+ (funcall func query))
+ ((let ((split-result (str:split #\Space query)))
+ (find (first split-result) *thanos/search-engines* :key #'first :test #'string=))
+ (let* ((engine-tag (subseq query 0 (position #\Space query)))
+ (query (subseq query (+ 1 (position #\Space query))))
+ (engine (find engine-tag *thanos/search-engines* :key #'first :test #'string=))
+ (search-url (second engine)))
+ (funcall func (cl-ppcre:regex-replace "~a" search-url (quri:url-encode query)))))
+ (t
+ (let* ((engine (first (last *thanos/search-engines*)))
+ (search-url (second engine)))
+ (funcall func (cl-ppcre:regex-replace "~a" search-url (quri:url-encode query)))))))
(defun thanos/make-buffer-focus-url (url)
(make-buffer-focus :url url))