Next: Switch to VI bindings

master
Pierre Neidhardt 2019-06-10 11:21:15 +02:00
parent 24453ab4c2
commit 6700ee2ea8
1 changed files with 12 additions and 15 deletions

View File

@ -5,19 +5,14 @@
(format nil "~a/common-lisp/next/ports/gtk-webkit/next-gtk-webkit"
(uiop:getenv "HOME")))
;; (setf (cdr (last (eval (get-default 'window 'search-engines))))
;; '(("yt" . "https://www.youtube.com/results?search_query=~a")))
(add-to-default-list 'vi-normal-mode 'buffer 'default-modes)
;; ;; (setf (cdr (last (eval (get-default 'window 'search-engines))))
;; ;; '(("yt" . "https://www.youtube.com/results?search_query=~a")))
(nconc (eval (get-default 'window 'search-engines))
'(("q" . "http://quickdocs.org/search?q=~a")
("yt" . "https://www.youtube.com/results?search_query=~a")))
(define-key (key "C-M-b") #'switch-buffer
(key "C-M-w") #'make-window
(key "C-M-d") #'delete-buffer
(key "C-;") #'execute-command
(key "M-g") #'go-anchor-new-buffer
(key "C-M-C") #'kill)
(defun eval-in-emacs (&rest s-exps)
"Evaluate S-EXPS with emacsclient."
(let ((s-exps-string (cl-strings:replace-all
@ -25,9 +20,9 @@
`(progn ,@s-exps) :case :downcase)
;; Discard the package prefix.
"next::" "")))
(format *error-output* "Sending to Emacs:~%~a~%" s-exps-string)
(uiop:run-program
(list "emacsclient" "--eval" s-exps-string))))
(log:debug "Sending to Emacs: ~a" s-exps-string)
(ignore-errors (uiop:run-program
(list "emacsclient" "--eval" s-exps-string)))))
(define-command org-capture ()
"Org-capture current page."
@ -43,7 +38,9 @@
:description ,title)))
`(org-capture))))
(define-key (key "C-M-o") #'org-capture)
(define-key "C-M-o" #'org-capture)
(define-key :scheme :vi-normal
"C-M-o" #'org-capture)
(define-command youtube-dl-current-page ()
"Download a video in the currently open buffer."
@ -52,10 +49,10 @@
(if (search "youtu" url)
`(progn (youtube-dl ,url) (youtube-dl-list))
`(ambrevar/youtube-dl-url ,url)))))
(define-key (key "C-M-c d") 'youtube-dl-current-page)
(define-key "C-M-c d" 'youtube-dl-current-page)
(define-command play-video-in-current-page ()
"Play video in the currently open buffer."
(with-result (url (buffer-get-url))
(uiop:run-program (list "mpv" url))))
(define-key (key "C-M-c v") 'play-video-in-current-page)
(define-key "C-M-c v" 'play-video-in-current-page)