From 9cf42d3e5f57aba207d75106aa6f5cc1f7de6dde Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Wed, 13 Dec 2017 14:34:51 +0100 Subject: [PATCH] eww: Init --- evil-collection-eww.el | 123 +++++++++++++++++++++++++++++++++++++++++ evil-collection.el | 1 + 2 files changed, 124 insertions(+) create mode 100644 evil-collection-eww.el diff --git a/evil-collection-eww.el b/evil-collection-eww.el new file mode 100644 index 0000000..d87b15f --- /dev/null +++ b/evil-collection-eww.el @@ -0,0 +1,123 @@ +;;; evil-collection-eww.el --- Evil bindings for EWW -*- lexical-binding: t -*- + +;; Copyright (C) 2017 Pierre Neidhardt + +;; Author: Pierre Neidhardt +;; Maintainer: James Nguyen +;; Pierre Neidhardt +;; URL: https://github.com/jojojames/evil-collection +;; Version: 0.0.1 +;; Package-Requires: ((emacs "25.1")) +;; Keywords: evil, eww, 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 . + +;;; Commentary: +;; Evil bindings for EWW. + +;;; Code: +(require 'eww) +(require 'evil) + +(defun evil-collection-eww-setup () + "Set up `evil' bindings for `eww'." + (evil-set-initial-state 'eww-mode 'motion) + (evil-define-key 'motion eww-mode-map + "^" 'eww-up-url + "u" 'eww-up-url + "U" 'eww-top-url + (kbd "") 'eww-back-url + "H" 'eww-back-url + "L" 'eww-forward-url + + "gf" 'eww-view-source ; Like qutebrowser. + + "yu" 'eww-copy-page-url + + "&" 'eww-browse-with-external-browser + "C" 'url-cookie-list + "D" 'eww-toggle-paragraph-direction + "X" 'eww-set-character-encoding + "x" 'eww-toggle-fonts + "d" 'eww-download + "b" 'eww-add-bookmark + + "]" 'eww-next-url + "[" 'eww-previous-url + "gj" 'eww-next-url + "gk" 'eww-previous-url + + ;; open + (kbd "S-") 'eww + "go" 'eww + + (kbd "SPC") 'scroll-up-command + (kbd "S-SPC") 'scroll-down-command + (kbd "") 'shr-next-link + (kbd "") 'shr-previous-link + + ;; bookmarks + "gb" 'eww-list-bookmarks + + "gh" 'eww-list-histories + "gt" 'eww-list-buffers ; Like dwb, qutebrowser. + + + ;; refresh + "gr" 'eww-reload + + ;; quit + "q" 'quit-window + "ZQ" 'quit-window + "ZZ" 'quit-window) + + (evil-set-initial-state 'eww-history-mode 'motion) + (evil-define-key 'motion eww-history-mode-map + (kbd "") 'eww-history-browse + ;; refresh + "gr" 'revert-buffer + ;; quit + "q" 'quit-window + "ZQ" 'quit-window + "ZZ" 'quit-window) + + (evil-set-initial-state 'eww-buffers-mode 'motion) + (evil-define-key 'motion eww-buffers-mode-map + "D" 'eww-buffer-kill + (kbd "") 'eww-buffer-select + "]" 'eww-buffer-show-next + "[" 'eww-buffer-show-previous + "gj" 'eww-buffer-show-next + "gk" 'eww-buffer-show-previous + ;; refresh + "gr" 'revert-buffer + ;; quit + "q" 'quit-window + "ZQ" 'quit-window + "ZZ" 'quit-window) + + (evil-set-initial-state 'eww-bookmark-mode 'motion) + (evil-define-key 'motion eww-bookmark-mode-map + "D" 'eww-bookmark-kill + (kbd "") 'eww-bookmark-browse + "yu" 'eww-bookmark-yank + ;; refresh + "gr" 'revert-buffer + ;; quit + "q" 'quit-window + "ZQ" 'quit-window + "ZZ" 'quit-window)) + +(provide 'evil-collection-eww) +;;; evil-collection-eww.el ends here diff --git a/evil-collection.el b/evil-collection.el index 6b0affa..c4990d4 100644 --- a/evil-collection.el +++ b/evil-collection.el @@ -66,6 +66,7 @@ emms eshell eval-sexp-fu + eww flycheck geiser ggtags