diff options
Diffstat (limited to '.config/emacs/lisp/evil-collection/modes/elfeed')
| -rw-r--r-- | .config/emacs/lisp/evil-collection/modes/elfeed/README.org | 64 | ||||
| -rw-r--r-- | .config/emacs/lisp/evil-collection/modes/elfeed/evil-collection-elfeed.el | 139 |
2 files changed, 203 insertions, 0 deletions
diff --git a/.config/emacs/lisp/evil-collection/modes/elfeed/README.org b/.config/emacs/lisp/evil-collection/modes/elfeed/README.org new file mode 100644 index 0000000..b1f2dcd --- /dev/null +++ b/.config/emacs/lisp/evil-collection/modes/elfeed/README.org @@ -0,0 +1,64 @@ +* elfeed + + Evil bindings for [[https://github.com/skeeto/elfeed][elfeed]]. + + Standard motion / quit bindings (=gg=, =G=, =j=, =k=, =q=, =ZZ=, =ZQ=) come + from =evil-collection-set-readonly-bindings= and are not repeated below. + +** elfeed-search-mode-map + + | Command | Original | Evil | + |----------------------------------+----------+---------------------| + | =elfeed-search-show-entry= | =RET= | =RET= | + | =elfeed-search-browse-url= | =b= | =S-RET=, =go= | + | =elfeed-search-yank= | =y= | =y= | + | =elfeed-search-live-filter= | =s= | =s= | + | =elfeed-search-set-filter= | =S= | =S= | + | =elfeed-search-clear-filter= | =c= | =c= | + | =elfeed-search-fetch= | =G= | =gR= | + | =revert-buffer= | =g= | =gr= | + | =elfeed-search-tag-all= | =+= | =+= | + | =elfeed-search-untag-all= | =-= | =-= | + | =elfeed-search-tag-all-unread= | =u= | =U= | + | =elfeed-search-untag-all-unread= | =r= | =u= | + | =scroll-up-command= | n/a | =SPC= | + | =scroll-down-command= | n/a | =S-SPC= | + | =elfeed-search-quit-window= | =q= | =q=, =ZQ=, =ZZ= ([[#fallbacks][†]]) | + +** elfeed-show-mode-map + + | Command | Original | Evil | + |-----------------------------------------+----------+-------------------| + | =elfeed-show-visit= | =b= | =S-RET=, =go= | + | =elfeed-show-yank= | =y= | =yu= | + | =elfeed-show-next= | =n= | =]]=, =gj=, =C-j= | + | =elfeed-show-prev= | =p= | =[[=, =gk=, =C-k= | + | =elfeed-show-refresh= | n/a | =gr= | + | =elfeed-show-new-live-search= | =s= | =s= | + | =elfeed-show-tag= | =+= | =+= | + | =elfeed-show-untag= | =-= | =-= | + | =elfeed-show-play-enclosure= | =P= | =P= | + | =elfeed-show-add-enclosure-to-playlist= | =A= | =A= | + | =elfeed-show-save-enclosure= | =d= | =d= | + | =elfeed-show-next-link= | =TAB= | =TAB= | + | =scroll-up-command= | =SPC= | =SPC= | + | =scroll-down-command= | =S-SPC= | =S-SPC= | + | =elfeed-kill-buffer= | =q= | =q=, =ZQ=, =ZZ= | + +** elfeed-tree-mode-map + + | Command | Original | Evil | + |----------------------+----------+-------| + | =elfeed-tree-search= | =RET= | =RET= | + +** Fallbacks + :PROPERTIES: + :CUSTOM_ID: fallbacks + :END: + + Two version-compat fallbacks fire only when running older elfeed: + + - Before elfeed commit =518e5bd3= (no =revert-buffer-function=), =gr= calls + =elfeed-search-update--force= instead of =revert-buffer=. + - Before elfeed commit =2ef14c92= (no =quit-window-hook= save), =q=, =ZQ=, + =ZZ= use =elfeed-search-quit-window= to persist the db on exit. diff --git a/.config/emacs/lisp/evil-collection/modes/elfeed/evil-collection-elfeed.el b/.config/emacs/lisp/evil-collection/modes/elfeed/evil-collection-elfeed.el new file mode 100644 index 0000000..c691575 --- /dev/null +++ b/.config/emacs/lisp/evil-collection/modes/elfeed/evil-collection-elfeed.el @@ -0,0 +1,139 @@ +;;; evil-collection-elfeed.el --- Evil bindings for elfeed -*- lexical-binding: t -*- + +;; Copyright (C) 2017 Pierre Neidhardt + +;; Author: Pierre Neidhardt <mail@ambrevar.xyz> +;; Maintainer: James Nguyen <james@jojojames.com> +;; Pierre Neidhardt <mail@ambrevar.xyz> +;; URL: https://github.com/emacs-evil/evil-collection +;; Version: 0.0.1 +;; Package-Requires: ((emacs "26.3")) +;; Keywords: evil, elfeed, tools + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published +;; by the Free Software Foundation; either version 3, or (at your +;; option) any later version. +;; +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; For a full copy of the GNU General Public License +;; see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;; Evil bindings for elfeed. + +;;; Code: +(require 'elfeed nil t) +(require 'evil-collection) + +(defvar elfeed-search-mode-map) +(defvar elfeed-show-mode-map) +(defvar elfeed-tree-mode-map) + +(defconst evil-collection-elfeed-maps '(elfeed-search-mode-map + elfeed-show-mode-map + elfeed-tree-mode-map)) + +;;;###autoload +(defun evil-collection-elfeed-setup () + "Set up `evil' bindings for `elfeed'." + + (evil-collection-set-readonly-bindings 'elfeed-search-mode-map) + (evil-set-initial-state 'elfeed-search-mode 'normal) + (evil-collection-define-key 'normal 'elfeed-search-mode-map + ;; open + (kbd "RET") 'elfeed-search-show-entry + (kbd "S-<return>") 'elfeed-search-browse-url + "go" 'elfeed-search-browse-url + + "y" 'elfeed-search-yank + + (kbd "SPC") 'scroll-up-command + (kbd "S-SPC") 'scroll-down-command + + ;; filter + "s" 'elfeed-search-live-filter + "S" 'elfeed-search-set-filter + "c" 'elfeed-search-clear-filter + + ;; refresh + "gR" 'elfeed-search-fetch ; TODO: Which update function is more useful? + "gr" 'revert-buffer + + ;; quit -- `q'/`ZZ' default to `quit-window' via + ;; `evil-collection-set-readonly-bindings'. + "ZQ" 'quit-window) + + ;; Refresh fallback for elfeed before commit 518e5bd3, where + ;; `revert-buffer-function' is not wired up. + (unless (fboundp 'elfeed-search--update-force) + (evil-collection-define-key 'normal 'elfeed-search-mode-map + "gr" 'elfeed-search-update--force)) + + ;; Quit fallback for elfeed before commit 2ef14c92, where + ;; `quit-window-hook' does not run `elfeed-db-save'. + (when (and (fboundp 'elfeed-search-quit-window) + (not (eq (indirect-function 'elfeed-search-quit-window) + (symbol-function 'quit-window)))) + (evil-collection-define-key 'normal 'elfeed-search-mode-map + "q" 'elfeed-search-quit-window + "ZQ" 'elfeed-search-quit-window + "ZZ" 'elfeed-search-quit-window)) + + (evil-collection-define-key '(normal visual) 'elfeed-search-mode-map + "+" 'elfeed-search-tag-all + "-" 'elfeed-search-untag-all + "U" 'elfeed-search-tag-all-unread + "u" 'elfeed-search-untag-all-unread) + + (evil-collection-set-readonly-bindings 'elfeed-show-mode-map) + (evil-set-initial-state 'elfeed-show-mode 'normal) + (evil-collection-define-key 'normal 'elfeed-show-mode-map + (kbd "S-<return>") 'elfeed-show-visit + "go" 'elfeed-show-visit + + (kbd "SPC") 'scroll-up-command + (kbd "S-SPC") 'scroll-down-command + (kbd "<tab>") 'elfeed-show-next-link + + ;; filter + "s" 'elfeed-show-new-live-search + + "+" 'elfeed-show-tag + "-" 'elfeed-show-untag + + "A" 'elfeed-show-add-enclosure-to-playlist + "P" 'elfeed-show-play-enclosure + "d" 'elfeed-show-save-enclosure + + "]]" 'elfeed-show-next + "[[" 'elfeed-show-prev + "gj" 'elfeed-show-next + "gk" 'elfeed-show-prev + (kbd "C-j") 'elfeed-show-next + (kbd "C-k") 'elfeed-show-prev + + ;; refresh + "gr" 'elfeed-show-refresh + + ;; quit + "q" 'elfeed-kill-buffer + "ZQ" 'elfeed-kill-buffer + "ZZ" 'elfeed-kill-buffer) + + ;; yu, like `eww' + (evil-collection-define-operator-key 'yank 'elfeed-show-mode-map + "u" 'elfeed-show-yank) + + (evil-collection-set-readonly-bindings 'elfeed-tree-mode-map) + (evil-set-initial-state 'elfeed-tree-mode 'normal) + (evil-collection-define-key 'normal 'elfeed-tree-mode-map + ;; open + (kbd "RET") 'elfeed-tree-search)) + +(provide 'evil-collection-elfeed) +;;; evil-collection-elfeed.el ends here |
