diff options
| author | Jonathan Lai <jonathanlai@gmail.com> | 2019-09-18 00:08:36 -0700 |
|---|---|---|
| committer | James N <james@jojojames.com> | 2019-10-09 19:41:45 -0700 |
| commit | aec0ecbb86a4a6761f89a9945435595a6ad202b1 (patch) | |
| tree | 07d53f271835ef7bb124775ab7647a8b5a942f75 /modes | |
| parent | 9346e4452bb1b62bf5825ca6b3c01abd80d33813 (diff) | |
Move mode files: evil-collection-*.el -> modes/*/evil-collection-*.el
Diffstat (limited to 'modes')
29 files changed, 2200 insertions, 0 deletions
diff --git a/modes/2048-game/evil-collection-2048-game.el b/modes/2048-game/evil-collection-2048-game.el new file mode 100644 index 0000000..c77d640 --- /dev/null +++ b/modes/2048-game/evil-collection-2048-game.el @@ -0,0 +1,54 @@ +;;; evil-collection-2048-game.el --- Evil bindings for `2048-game' -*- lexical-binding: t -*- + +;; Copyright (C) 2019 James Nguyen + +;; Author: Daniel Phan <daniel.phan36@gmail.com> +;; 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 "25.1")) +;; Keywords: evil, games + +;; This program 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 of the License, or +;; (at your option) any later version. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;; Evil bindings for `2048-game'. + +;;; Code: +(require 'evil-collection) +(require '2048-game nil t) + +(defconst evil-collection-2048-game-maps '(2048-mode-map)) + +;;;###autoload +(defun evil-collection-2048-game-setup () + "Set up `evil' bindings for `2048-game'." + (evil-set-initial-state '2048-mode 'normal) + (evil-collection-define-key 'normal '2048-mode-map + "h" '2048-left + "j" '2048-down + "k" '2048-up + "l" '2048-right + "r" '2048-random-move + (kbd "<up>") '2048-up + (kbd "<left>") '2048-left + (kbd "<right>") '2048-right + (kbd "<down>") '2048-down + "q" 'quit-window + "ZQ" 'evil-quit + "ZZ" 'quit-window)) + +(provide 'evil-collection-2048-game) +;;; evil-collection-2048-game.el ends here diff --git a/modes/apropos/evil-collection-apropos.el b/modes/apropos/evil-collection-apropos.el new file mode 100644 index 0000000..8b247d0 --- /dev/null +++ b/modes/apropos/evil-collection-apropos.el @@ -0,0 +1,50 @@ +;;; evil-collection-apropos.el --- Evil bindings for apropos-mode -*- lexical-binding: t -*- + +;; Copyright (C) 2019 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 "25.1")) +;; Keywords: evil, help, tools + +;; This program 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 of the License, or +;; (at your option) any later version. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;; Evil bindings for `apropos-mode'. + +;;; Code: +(require 'evil-collection) +(require 'apropos) + +(defconst evil-collection-apropos-maps '(apropos-mode-map)) + +;;;###autoload +(defun evil-collection-apropos-setup () + "Set up `evil' bindings for `apropos'." + (evil-set-initial-state 'apropos-mode 'normal) + (evil-collection-define-key 'normal 'apropos-mode-map + (kbd "RET") 'apropos-follow + "g?" 'describe-mode + "gr" 'revert-buffer + + ;; quit + "q" 'quit-window + "ZQ" 'evil-quit + "ZZ" 'quit-window)) + +(provide 'evil-collection-apropos) +;;; evil-collection-apropos.el ends here diff --git a/modes/deadgrep/evil-collection-deadgrep.el b/modes/deadgrep/evil-collection-deadgrep.el new file mode 100644 index 0000000..55e9c4b --- /dev/null +++ b/modes/deadgrep/evil-collection-deadgrep.el @@ -0,0 +1,62 @@ +;;; evil-collection-deadgrep.el --- Bindings for deadgrep. -*- lexical-binding: t -*- + +;; Copyright (C) 2018 James Nguyen + +;; Author: James Nguyen <james@jojojames.com> +;; 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 "25.1")) +;; Keywords: evil, emacs, tools + +;; This program 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 of the License, or +;; (at your option) any later version. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;;; Bindings for deadgrep. + +;;; Code: +(require 'evil-collection) +(require 'deadgrep nil t) + +(defconst evil-collection-deadgrep-maps '(deadgrep-edit-mode-map + deadgrep-mode-map)) + +;;;###autoload +(defun evil-collection-deadgrep-setup () + "Set up `evil' bindings for deadgrep.." + (evil-collection-define-key 'normal 'deadgrep-edit-mode-map + (kbd "RET") 'deadgrep-visit-result + (kbd "<escape>") 'deadgrep-mode) + (evil-collection-define-key 'normal 'deadgrep-mode-map + (kbd "RET") 'deadgrep-visit-result + (kbd "<S-return>") 'deadgrep-visit-result-other-window + "go" 'deadgrep-visit-result-other-window + "gr" 'deadgrep-restart + (kbd "C-j") 'deadgrep-forward + (kbd "C-k") 'deadgrep-backward + (kbd "TAB") 'deadgrep-toggle-file-results + + "i" 'deadgrep-edit-mode + + ;; FIXME: Maybe we should bind this to something? + ;; (define-key map (kbd "C-c C-k") #'deadgrep-kill-process) + + ;; Quit + "q" 'quit-window + "ZZ" 'quit-window + "ZQ" 'evil-quit)) + +(provide 'evil-collection-deadgrep) +;;; evil-collection-deadgrep.el ends here diff --git a/modes/disk-usage/evil-collection-disk-usage.el b/modes/disk-usage/evil-collection-disk-usage.el new file mode 100644 index 0000000..e8c2a7a --- /dev/null +++ b/modes/disk-usage/evil-collection-disk-usage.el @@ -0,0 +1,99 @@ +;;; evil-collection-disk-usage.el --- Evil bindings for disk-usage.el -*- lexical-binding: t -*- + +;; Copyright (C) 2019 Pierre Neidhardt + +;; Author: James Nguyen <james@jojojames.com> +;; 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 "25.1")) +;; Keywords: evil, files, convenience, tools + +;; This program 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 of the License, or +;; (at your option) any later version. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;; Evil bindings for `disk-usage-mode'. + +;;; Code: +(require 'evil-collection) +(require 'disk-usage nil t) + +(defconst evil-collection-disk-usage-maps '(disk-usage-mode-map + disk-usage-by-types-mode-map)) + +;;;###autoload +(defun evil-collection-disk-usage-setup () + "Set up `evil' bindings for `disk-usage'." + (evil-collection-inhibit-insert-state 'disk-usage-mode-map) + (evil-collection-define-key 'normal 'disk-usage-mode-map + ;; motion + (kbd "SPC") 'scroll-up-command + (kbd "S-SPC") 'scroll-down-command + (kbd "<tab>") 'forward-button + (kbd "<backtab>") 'backward-button + + "S" 'tabulated-list-sort + "^" 'disk-usage-up + + "zh" 'disk-usage-toggle-human-readable + "zf" 'disk-usage-toggle-full-path + "zr" 'disk-usage-toggle-recursive + + (kbd "ze") 'disk-usage-eshell-at-point + (kbd "zs") 'disk-usage-shell-at-point + (kbd "d") 'disk-usage-dired-at-point + + "m" 'disk-usage-mark + "u" 'disk-usage-unmark + "x" 'disk-usage-delete-marked-files + + "a" 'disk-usage-add-filters + "A" 'disk-usage-remove-filters + + "g?" 'describe-mode + "gr" 'revert-buffer + + ;; quit + "q" 'quit-window + "ZQ" 'evil-quit + "ZZ" 'quit-window) + + (evil-collection-inhibit-insert-state 'disk-usage-by-types-mode-map) + (evil-collection-define-key 'normal 'disk-usage-by-types-mode-map + ;; motion + (kbd "SPC") 'scroll-up-command + (kbd "S-SPC") 'scroll-down-command + (kbd "<tab>") 'forward-button + (kbd "<backtab>") 'backward-button + + (kbd "RET") 'disk-usage-files + + "S" 'tabulated-list-sort + + "zh" 'disk-usage-toggle-human-readable + + "g?" 'describe-mode + "gr" 'revert-buffer + + "a" 'disk-usage-add-filters + "A" 'disk-usage-remove-filters + + ;; quit + "q" 'quit-window + "ZQ" 'evil-quit + "ZZ" 'quit-window)) + +(provide 'evil-collection-disk-usage) +;;; evil-collection-disk-usage.el ends here diff --git a/modes/ebib/evil-collection-ebib.el b/modes/ebib/evil-collection-ebib.el new file mode 100644 index 0000000..cfb098c --- /dev/null +++ b/modes/ebib/evil-collection-ebib.el @@ -0,0 +1,76 @@ +;;; evil-collection-ebib.el --- Evil bindings for ebib -*- lexical-binding: t -*- + +;; Author: Justin Burkett +;; URL: https://github.com/emacs-evil/evil-collection +;; Version: 0.0.1 +;; Package-Requires: ((emacs "25.1")) +;; Keywords: evil, ebib, 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 the ebib. + +;;; Code: +(require 'evil-collection) +(require 'ebib nil t) + +(defconst evil-collection-ebib-maps '(ebib-index-mode-map + ebib-entry-mode-map)) + +(defvar ebib-index-mode-map) +(defvar ebib-entry-mode-map) + +;;;###autoload +(defun evil-collection-ebib-setup () + "Set up `evil' bindings for `ebib'." + (evil-set-initial-state 'ebib-index-mode 'normal) + (evil-make-overriding-map ebib-index-mode-map 'normal) + (evil-collection-inhibit-insert-state 'ebib-index-mode-map) + (evil-collection-define-key 'normal 'ebib-index-mode-map + "d" 'ebib-kill-entry + "D" 'ebib-delete-entry + "gg" 'ebib-goto-first-entry + "G" 'ebib-goto-last-entry + "j" 'ebib-next-entry + "k" 'ebib-prev-entry + "n" 'ebib-search-next + "p" 'ebib-yank-entry + "ZQ" 'ebib-quit + "ZZ" 'ebib-quit + (kbd "C-u") 'ebib-index-scroll-down + (kbd "C-d") 'ebib-index-scroll-up + (kbd "C-b") 'ebib-index-scroll-down + (kbd "C-f") 'ebib-index-scroll-up) + (evil-set-initial-state 'ebib-entry-mode 'normal) + (evil-make-overriding-map ebib-entry-mode-map 'normal) + (evil-collection-inhibit-insert-state 'ebib-entry-mode-map) + (evil-collection-define-key 'normal 'ebib-entry-mode-map + "[[" 'ebib-goto-prev-set + "]]" 'ebib-goto-next-set + "d" 'ebib-kill-field-contents + "D" 'ebib-delete-field-contents + "gg" 'ebib-goto-first-field + "gk" 'ebib-goto-prev-set + "gj" 'ebib-goto-next-set + "G" 'ebib-goto-last-field + "j" 'ebib-next-field + "k" 'ebib-prev-field + "p" 'ebib-yank-field-contents + "y" 'ebib-copy-field-contents + "ZZ" 'ebib-quit-entry-buffer + "ZQ" 'ebib-quit-entry-buffer)) + +(provide 'evil-collection-ebib) +;;; evil-collection-ebib.el ends here diff --git a/modes/edbi/evil-collection-edbi.el b/modes/edbi/evil-collection-edbi.el new file mode 100644 index 0000000..9381746 --- /dev/null +++ b/modes/edbi/evil-collection-edbi.el @@ -0,0 +1,108 @@ +;;; evil-collection-edbi.el --- Evil bindings for EDBI -*- lexical-binding: t -*- + +;; Copyright (C) 2019 Pierre Neidhardt <mail@ambrevar.xyz> + +;; Author: James Nguyen <james@jojojames.com> +;; 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 "25.1")) +;; Keywords: evil, database, tools + +;; This program 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 of the License, or +;; (at your option) any later version. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;; Evil bindings for EDBI. + +;;; Code: +(require 'evil-collection) +(require 'edbi nil t) + +(defvar ctbl:table-mode-map) +(defvar edbi:dbview-keymap) +(declare-function ctbl:define-keymap "ctable") +(declare-function epc:add-keymap "epc") + +(defconst evil-collection-edbi-maps '(edbi:dbview-query-result-keymap + edbi:sql-mode-map)) + +(defun evil-collection-edbi-dbview-setup () + "The `ctbl:table-mode-map' and `edbi:dbview-keymap' are stored +as local maps and are not bound to any mode. As such, the only +way to add Evil bindings to the dbview is to overwrite the +default bindings." + (setq ctbl:table-mode-map + (ctbl:define-keymap + '( + ("k" . ctbl:navi-move-up) + ("j" . ctbl:navi-move-down) + ("h" . ctbl:navi-move-left) + ("l" . ctbl:navi-move-right) + + ("gc" . ctbl:navi-jump-to-column) + + ("$" . ctbl:navi-move-right-most) + ("0" . ctbl:navi-move-left-most) + + ("gr" . ctbl:action-update-buffer) + + ("g?" . ctbl:describe-bindings) + + ([mouse-1] . ctbl:navi-on-click) + ("C-m" . ctbl:navi-on-click) + ("RET" . ctbl:navi-on-click)))) + + (setq edbi:dbview-keymap + (epc:add-keymap + ctbl:table-mode-map + '(("gr" . edbi:dbview-update-command) + ("SPC" . edbi:dbview-show-tabledef-command) + ("c" . edbi:dbview-query-editor-command) + ("C" . edbi:dbview-query-editor-new-command) + ("C-m" . edbi:dbview-show-table-data-command) + ("q" . edbi:dbview-quit-command))))) + +;;;###autoload +(defun evil-collection-edbi-setup () + "Set up `evil' bindings for EDBI." + (evil-collection-edbi-dbview-setup) + (evil-collection-define-key 'normal 'edbi:dbview-query-result-keymap + "0" 'ctbl:navi-move-left-most + "$" 'ctbl:navi-move-right-most + + "h" 'ctbl:navi-move-left + "j" 'ctbl:navi-move-down + "k" 'ctbl:navi-move-up + "l" 'ctbl:navi-move-right + + "gc" 'ctbl:navi-jump-to-column + + "g?" 'ctbl:describe-bindings + + ;; motion + "gr" 'ctbl:action-update-buffer + + ;; quit + "q" 'edbi:dbview-query-result-quit-command + "ZQ" 'evil-quit + "ZZ" 'quit-window) + + (evil-collection-define-key 'normal 'edbi:sql-mode-map + "q" 'edbi:dbview-query-editor-quit-command + (kbd "C-n") 'edbi:dbview-query-editor-history-forward-command + (kbd "C-p") 'edbi:dbview-query-editor-history-back-command)) + +(provide 'evil-collection-edbi) +;;; evil-collection-edbi.el ends here diff --git a/modes/eglot/evil-collection-eglot.el b/modes/eglot/evil-collection-eglot.el new file mode 100644 index 0000000..e2d0cfa --- /dev/null +++ b/modes/eglot/evil-collection-eglot.el @@ -0,0 +1,43 @@ +;;; evil-collection-eglot.el --- Bindings for `eglot'. -*- lexical-binding: t -*- + +;; Copyright (C) 2018 James Nguyen + +;; Author: James Nguyen <james@jojojames.com> +;; Maintainer: James Nguyen <james@jojojames.com> +;; URL: https://github.com/emacs-evil/evil-collection +;; Version: 0.0.1 +;; Package-Requires: ((emacs "25.1")) +;; Keywords: evil, eglot, tools + +;; This program 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 of the License, or +;; (at your option) any later version. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;;; Bindings for `eglot'. + +;;; Code: +(require 'eglot nil t) +(require 'evil-collection) + +(defconst evil-collection-eglot-maps '(eglot-mode-map)) + +;;;###autoload +(defun evil-collection-eglot-setup () + "Set up `evil' bindings for `eglot'." + (evil-collection-define-key 'normal 'eglot-mode-map + "gd" 'xref-find-definitions + (kbd "C-t") 'xref-pop-marker-stack + "K" 'eglot-help-at-point)) + +(provide 'evil-collection-eglot) +;;; evil-collection-eglot.el ends here diff --git a/modes/elisp-slime-nav/evil-collection-elisp-slime-nav.el b/modes/elisp-slime-nav/evil-collection-elisp-slime-nav.el new file mode 100644 index 0000000..f48a107 --- /dev/null +++ b/modes/elisp-slime-nav/evil-collection-elisp-slime-nav.el @@ -0,0 +1,44 @@ +;;; evil-collection-elisp-slime-nav.el --- Bindings for `elisp-slime-nav'. -*- lexical-binding: t -*- + +;; Copyright (C) 2019 James Nguyen + +;; Author: James Nguyen <james@jojojames.com> +;; 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 "25.1")) +;; Keywords: evil, elisp-slime-nav, tools + +;; This program 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 of the License, or +;; (at your option) any later version. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;;; Bindings for `elisp-slime-nav'. + +;;; Code: +(require 'evil-collection) +(require 'elisp-slime-nav nil t) + +(defconst evil-collection-elisp-slime-nav-maps '(elisp-slime-nav-mode-map)) + +;;;###autoload +(defun evil-collection-elisp-slime-nav-setup () + "Set up `evil' bindings for `elisp-slime-nav'." + (evil-collection-define-key 'normal 'elisp-slime-nav-mode-map + "gd" 'elisp-slime-nav-find-elisp-thing-at-point + (kbd "C-t") 'pop-tag-mark + "K" 'elisp-slime-nav-describe-elisp-thing-at-point)) + +(provide 'evil-collection-elisp-slime-nav) +;;; evil-collection-elisp-slime-nav.el ends here diff --git a/modes/evil-mc/evil-collection-evil-mc.el b/modes/evil-mc/evil-collection-evil-mc.el new file mode 100644 index 0000000..4f095ae --- /dev/null +++ b/modes/evil-mc/evil-collection-evil-mc.el @@ -0,0 +1,61 @@ +;;; evil-collection-evil-mc.el --- Bindings for evil-mc -*- lexical-binding: t -*- + +;; Copyright (C) 2018 James Nguyen + +;; Author: James Nguyen <james@jojojames.com> +;; Maintainer: James Nguyen <james@jojojames.com> +;; Pierre Neidhardt <mail@ambrevar.xyz> +;; URL: https://github.com/emacs-evil/evil-collection +;; Version: 0.0.2 +;; Package-Requires: ((emacs "25.1")) +;; Keywords: evil, emacs, tools + +;; This program 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 of the License, or +;; (at your option) any later version. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;;; Bindings for evil-mc. + +;;; Code: +(require 'evil-collection) +(require 'evil-mc nil t) +(eval-when-compile (require 'subr-x)) ; `if-let*' and `when-let*' + +(defvar evil-mc-map) +(defconst evil-collection-evil-mc-maps '(evil-mc-mode-map)) + +(defun evil-collection-evil-mc-clear-keymap (&rest _args) + "Brute force remove `evil-mc-key-map' from `evil-mode-map-alist'." + (evil-collection-when-let* + ((evil-mc-map (assq 'evil-mc-mode evil-mode-map-alist))) + (setq evil-mode-map-alist + (delq evil-mc-map evil-mode-map-alist)))) + +;;;###autoload +(defun evil-collection-evil-mc-setup () + "Set up `evil' bindings for evil-mc." + ;; `evil-mc''s default keybindings conflict with `evil-collection' using the + ;; 'gr' prefix. We brute force remove the keymap so that packages will play + ;; nice. Open to other suggestions on how to work with `evil-mc'. + ;; See https://github.com/emacs-evil/evil-collection/issues/184 for more + ;; details. + (advice-add 'evil-normalize-keymaps + :after 'evil-collection-evil-mc-clear-keymap) + + ;; https://github.com/gabesoft/evil-mc/issues/70 + (add-hook 'evil-mc-after-cursors-deleted + (lambda () + (setq evil-was-yanked-without-register t)))) + +(provide 'evil-collection-evil-mc) +;;; evil-collection-evil-mc.el ends here diff --git a/modes/flymake/evil-collection-flymake.el b/modes/flymake/evil-collection-flymake.el new file mode 100644 index 0000000..95d03b7 --- /dev/null +++ b/modes/flymake/evil-collection-flymake.el @@ -0,0 +1,50 @@ +;;; evil-collection-flymake.el --- Evil Bindings for Flymake -*- lexical-binding: t -*- + +;; Copyright (C) 2018 James Nguyen + +;; Author: James Nguyen <james@jojojames.com> +;; 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 "25.1")) +;; Keywords: evil, flymake, tools + +;; This program 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 of the License, or +;; (at your option) any later version. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;; Evil bindings for `flymake-mode'. + +;;; Code: +(require 'flymake) +(require 'evil-collection) + +(defconst evil-collection-flymake-maps '(flymake-mode-map + flymake-diagnostics-buffer-mode-map)) + +;;;###autoload +(defun evil-collection-flymake-setup () + "Set up `evil' bindings for `flymake'." + (evil-collection-define-key + '(normal visual) 'flymake-diagnostics-buffer-mode-map + "q" 'quit-window + (kbd "RET") 'flymake-goto-diagnostic + (kbd "<S-return>") 'flymake-show-diagnostic + (kbd "M-RET") 'flymake-show-diagnostic + (kbd "go") 'flymake-show-diagnostic + (kbd "gO") 'flymake-show-diagnostic + "." 'flymake-goto-diagnostic)) + +(provide 'evil-collection-flymake) +;;; evil-collection-flymake.el ends here diff --git a/modes/hackernews/evil-collection-hackernews.el b/modes/hackernews/evil-collection-hackernews.el new file mode 100644 index 0000000..a3798e7 --- /dev/null +++ b/modes/hackernews/evil-collection-hackernews.el @@ -0,0 +1,68 @@ +;;; evil-collection-hackernews.el --- Evil bindings for hackernews-mode -*- lexical-binding: t -*- + +;; Copyright (C) 2018 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 "25.1")) +;; Keywords: evil, news, 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 hackernews. + +;;; Code: +(require 'evil-collection) +(require 'hackernews nil t) + +(defconst evil-collection-hackernews-maps '(hackernews-mode-map + hackernews-button-map)) + +;;;###autoload +(defun evil-collection-hackernews-setup () + "Set up `evil' bindings for `hackernews-mode'." + (evil-collection-inhibit-insert-state 'hackernews-mode-map) + (evil-collection-define-key 'normal 'hackernews-mode-map + "]]" 'hackernews-next-item + "[[" 'hackernews-previous-item + "gj" 'hackernews-next-item + "gk" 'hackernews-previous-item + (kbd "C-j") 'hackernews-next-item + (kbd "C-k") 'hackernews-previous-item + + "+" 'hackernews-load-more-stories + + "gr" 'hackernews-reload + "gf" 'hackernews-switch-feed + + (kbd "<tab>") 'hackernews-next-comment + (kbd "S-<tab>") 'hackernews-previous-comment + + "!" 'hackernews-button-mark-as-visited ; like mu4e + "?" 'hackernews-button-mark-as-unvisited + + (kbd "RET") 'hackernews-button-browse-internal + (kbd "S-<return>") 'push-button + + ;; quit + "q" 'quit-window + "ZQ" 'evil-quit + "ZZ" 'evil-quit)) + +(provide 'evil-collection-hackernews) +;;; evil-collection-hackernews.el ends here diff --git a/modes/helpful/evil-collection-helpful.el b/modes/helpful/evil-collection-helpful.el new file mode 100644 index 0000000..502d508 --- /dev/null +++ b/modes/helpful/evil-collection-helpful.el @@ -0,0 +1,58 @@ +;;; evil-collection-helpful.el --- Evil bindings for helpful-mode -*- lexical-binding: t -*- + +;; Copyright (C) 2018 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 "25.1")) +;; Keywords: evil, help, tools + +;; This program 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 of the License, or +;; (at your option) any later version. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;; Evil bindings for `helpful-mode'. + +;;; Code: +(require 'evil-collection) +(require 'helpful nil t) + +(defconst evil-collection-helpful-maps '(helpful-mode-map)) + +;;;###autoload +(defun evil-collection-helpful-setup () + "Set up `evil' bindings for `helpful'." + (evil-collection-inhibit-insert-state 'helpful-mode-map) + (evil-collection-define-key 'normal 'helpful-mode-map + ;; motion + (kbd "<tab>") 'forward-button + (kbd "<backtab>") 'backward-button + + ;; The following bindings don't do what they are supposed to. "go" should open + ;; in the same window and "gO" should open in a different one. + "go" 'push-button + "gO" 'push-button + + "g?" 'describe-mode + "gr" 'helpful-update + + ;; quit + "q" 'quit-window + "ZQ" 'evil-quit + "ZZ" 'quit-window)) + +(provide 'evil-collection-helpful) +;;; evil-collection-helpful.el ends here diff --git a/modes/hg-histedit/evil-collection-hg-histedit.el b/modes/hg-histedit/evil-collection-hg-histedit.el new file mode 100644 index 0000000..57628dc --- /dev/null +++ b/modes/hg-histedit/evil-collection-hg-histedit.el @@ -0,0 +1,49 @@ +;;; evil-collection-hg-histedit.el --- Bindings for `hg-histedit'. -*- lexical-binding: t -*- + +;; Copyright (C) 2019 James Nguyen + +;; Author: James Nguyen <james@jojojames.com> +;; 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 "25.1")) +;; Keywords: emacs, tools + +;; This program 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 of the License, or +;; (at your option) any later version. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;;; Bindings for `hg-histedit'. + +;;; Code: +(require 'evil-collection) +(require 'hg-histedit nil t) + +(defconst evil-collection-hg-histedit-maps '(hg-histedit-mode-map)) + +;;;###autoload +(defun evil-collection-hg-histedit-setup () + "Set up `evil' bindings for `hg-histedit'." + (evil-collection-define-key 'normal 'hg-histedit-mode-map + "e" 'hg-histedit-modify-commit-with-edit + "m" 'hg-histedit-modify-commit-with-mess + "p" 'hg-histedit-modify-commit-with-pick + "b" 'hg-histedit-modify-commit-with-base + "d" 'hg-histedit-modify-commit-with-drop + "f" 'hg-histedit-modify-commit-with-fold + "r" 'hg-histedit-modify-commit-with-roll + "u" 'hg-histedit-undo)) + +(provide 'evil-collection-hg-histedit) +;;; evil-collection-hg-histedit.el ends here diff --git a/modes/hungry-delete/evil-collection-hungry-delete.el b/modes/hungry-delete/evil-collection-hungry-delete.el new file mode 100644 index 0000000..8612fac --- /dev/null +++ b/modes/hungry-delete/evil-collection-hungry-delete.el @@ -0,0 +1,62 @@ +;;; evil-collection-hungry-delete.el --- Bindings for `hungry-delete'. -*- lexical-binding: t -*- + +;; Copyright (C) 2019 James Nguyen + +;; Author: James Nguyen <james@jojojames.com> +;; 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 "25.1")) +;; Keywords: evil, hungry-delete, tools + +;; This program 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 of the License, or +;; (at your option) any later version. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;;; Bindings for `hungry-delete'. + +;;; Code: +(require 'evil-collection) +(require 'hungry-delete nil t) + +(defconst evil-collection-hungry-delete-maps '(hungry-delete-mode-map)) + +(defun evil-collection-hungry-delete (f &rest args) + "Wrapper function to run `hungry-delete-backward' if +`hungry-delete-mode' is on." + (interactive) + (if (and (bound-and-true-p hungry-delete-mode) + (fboundp 'hungry-delete-backward)) + (hungry-delete-backward 1) + (apply f args))) + +(defun evil-collection-hungry-delete-for-join (f &rest args) + "Wrapper function to run `hungry-delete-backward' if +`hungry-delete-mode' is on." + (interactive) + (if (and (bound-and-true-p hungry-delete-mode) + (fboundp 'hungry-delete-backward)) + (hungry-delete-backward 1) + (funcall f args))) + +;;;###autoload +(defun evil-collection-hungry-delete-setup () + "Set up `evil' bindings for `hungry-delete'." + (advice-add 'evil-delete-backward-char + :around #'evil-collection-hungry-delete) + (advice-add 'evil-delete-backward-char-and-join + :around #'evil-collection-hungry-delete-for-join)) + +(provide 'evil-collection-hungry-delete) +;;; evil-collection-hungry-delete.el ends here diff --git a/modes/image-dired/evil-collection-image-dired.el b/modes/image-dired/evil-collection-image-dired.el new file mode 100644 index 0000000..12d0b0c --- /dev/null +++ b/modes/image-dired/evil-collection-image-dired.el @@ -0,0 +1,74 @@ +;;; evil-collection-image-dired.el --- Evil bindings for image-dired-thumbnail-mode -*- lexical-binding: t -*- + +;; Copyright (C) 2018 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 "25.1")) +;; Keywords: evil, dired, image, 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 `image-dired-thumbnail-mode'. + +;;; Code: +(require 'evil-collection) +(require 'image-dired) + +(defconst evil-collection-image-dired-maps '(image-dired-thumbnail-mode-map)) + +;;;###autoload +(defun evil-collection-image-dired-setup () + "Set up `evil' bindings for `image-dired-thumbnail-mode'." + (evil-collection-define-key 'normal 'image-dired-thumbnail-mode-map + ;; motion + "h" 'image-dired-backward-image + "l" 'image-dired-forward-image + "j" 'image-dired-next-line + "k" 'image-dired-previous-line + + (kbd "SPC") 'image-dired-display-next-thumbnail-original + (kbd "S-SPC") 'image-dired-display-previous-thumbnail-original + (kbd "RET") 'image-dired-display-thumbnail-original-image + + "c" 'image-dired-comment-thumbnail + "d" 'image-dired-thumbnail-set-image-description + "m" 'image-dired-mark-thumb-original-file + "u" 'image-dired-unmark-thumb-original-file + "D" 'image-dired-delete-char + + ;; See image+. + "r" 'image-dired-rotate-thumbnail-right + "R" 'image-dired-rotate-thumbnail-left + "<" 'image-dired-rotate-original-left ; like sxiv + ">" 'image-dired-rotate-original-right ; like sxiv + + "tr" 'image-dired-tag-thumbnail-remove + "tt" 'image-dired-tag-thumbnail + + "ff" 'image-dired-line-up + "fd" 'image-dired-line-up-dynamic + "fi" 'image-dired-line-up-interactive + + ;; quit + "q" 'quit-window + "ZQ" 'evil-quit + "ZZ" 'quit-window)) + +(provide 'evil-collection-image-dired) +;;; evil-collection-image-dired.el ends here diff --git a/modes/leetcode/evil-collection-leetcode.el b/modes/leetcode/evil-collection-leetcode.el new file mode 100644 index 0000000..86e4f78 --- /dev/null +++ b/modes/leetcode/evil-collection-leetcode.el @@ -0,0 +1,46 @@ +;;; evil-collection-leetcode.el --- Bindings for `leetcode'. -*- lexical-binding: t -*- + +;; Copyright (C) 2019 James Nguyen + +;; Author: James Nguyen <james@jojojames.com> +;; 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 "25.1")) +;; Keywords: emacs, tools + +;; This program 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 of the License, or +;; (at your option) any later version. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;;; Bindings for `leetcode'. + +;;; Code: +(require 'evil-collection) +(require 'leetcode nil t) + +(defconst evil-collection-leetcode-maps + '(leetcode--problems-mode-map + leetcode--problem-description-mode-map)) + +;;;###autoload +(defun evil-collection-leetcode-setup () + "Set up `evil' bindings for `leetcode'." + (evil-collection-define-key 'normal 'leetcode--problems-mode-map + (kbd "RET") 'leetcode-show-description + "gr" 'leetcode-problems-refresh + "q" 'quit-window)) + +(provide 'evil-collection-leetcode) +;;; evil-collection-leetcode.el ends here diff --git a/modes/lispy/evil-collection-lispy.el b/modes/lispy/evil-collection-lispy.el new file mode 100644 index 0000000..1732331 --- /dev/null +++ b/modes/lispy/evil-collection-lispy.el @@ -0,0 +1,256 @@ +;;; evil-collection-lispy.el --- Evil Bindings for Lispy -*- lexical-binding: t; no-byte-compile: t; -*- + +;; Copyright (C) 2018 James Nguyen + +;; Author: James Nguyen <james@jojojames.com> +;; 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 "25.1")) +;; Keywords: evil, lispy, tools + +;; This program 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 of the License, or +;; (at your option) any later version. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;; Evil bindings for `lispy-mode'. +;; This is not included in the default init list for `evil-collection'. +;; Add `lispy' to `evil-collection-mode-list' to use this package. +;; e.g. (push 'lispy evil-collection-mode-list) +;; This file is meant to be an experimental ground for `lispy' keybindings +;; and the changes here are intended to be created as a PR to the main `lispy' +;; repository. +;; PRs, tweaks or comments are very welcome! + +;;; Code: +(require 'lispy nil t) +(require 'evil-collection) + +(defconst evil-collection-lispy-maps '(lispy-mode-map)) + +(defvar lispy-mode-map-base) +(defvar lispy-mode-map-special) +(defvar lispy-mode-map-lispy) +(defvar lispy-mode-map-paredit) +(defvar lispy-mode-map-parinfer) +(defvar lispy-mode-map-evilcp) +(defvar lispy-mode-map-c-digits) +(defvar lispy-mode-map-oleh) +(defvar lispy-mode-map) +(declare-function lispy-define-key "lispy") +(declare-function lispy-set-key-theme "lispy") + +(declare-function lispyville-insert-at-beginning-of-list "lispyville") +(declare-function lispyville-insert-at-end-of-list "lispyville") + +(defun evil-collection-lispy-insert-at-end-of-list () + "Forward list and enter insert state." + (interactive) + (lispyville-insert-at-end-of-list 1)) + +(defun evil-collection-lispy-insert-at-beginning-of-list () + "Backward list and enter insert state." + (interactive) + (lispyville-insert-at-beginning-of-list 1)) + +(defhydra g-knight (:color blue :hint nil :idle .3) + "g knight" + ("j" lispy-knight-down "Knight Down") + ("k" lispy-knight-up "Knight Up") + ("g" lispy-beginning-of-defun "Beginning of Defun") + ("d" lispy-goto "Goto") + ("l" lispy-goto-local "Goto Local")) + +(defhydra lispy-tab-hydra (:color blue :hint nil :idle .3) + "Tab" + ("i" lispy-tab "Tab") + ("s" lispy-shifttab "Shifttab")) + +(defvar evil-collection-lispy-mode-map-special-evil + (let ((map (make-sparse-keymap))) + ;; navigation + (lispy-define-key map "l" 'lispy-right) + (lispy-define-key map "h" 'lispy-left) + (lispy-define-key map "f" 'lispy-ace-paren + :override '(cond ((bound-and-true-p view-mode) + (View-quit)))) ;; `lispy-flow' -> w + (lispy-define-key map "j" 'lispy-down) + (lispy-define-key map "k" 'lispy-up) + (lispy-define-key map "d" 'lispy-delete) ;; `lispy-different' -> o + (lispy-define-key map "o" 'lispy-different) ;; `lispy-other-mode' -> Q + (lispy-define-key map "p" 'lispy-paste) ;; `lispy-eval-other-window' -> P + (lispy-define-key map "P" 'lispy-eval-other-window) ;; `lispy-paste' -> p + (lispy-define-key map "y" 'lispy-new-copy) ;; `lispy-occur' -> / + + (lispy-define-key map "g" 'g-knight/body) ;; `lispy-goto' -> gd + + ;; FIXME: Looks like one of the evil keymaps is taking precedence. + (lispy-define-key map "C-t" 'pop-tag-mark) + + ;; outline + (lispy-define-key map "J" 'lispy-join) ;; `lispy-outline-next' + (lispy-define-key map "K" 'lispy-describe) ;; `lispy-outline-prev' + (lispy-define-key map "L" 'lispy-outline-goto-child) + + ;; Paredit transformations + (lispy-define-key map ">" 'lispy-slurp-or-barf-right) ;; `lispy-slurp' + (lispy-define-key map "<" 'lispy-slurp-or-barf-left) ;; `lispy-barf' + + ;; FIXME: This doesn't work for me for some reason. + ;; `lispy-occur' doesn't show up in evil-collection-lispy-mode-map-special-evil. + ;; Evaluating lispy-define-key again in *scratch* works... + (lispy-define-key map "/" 'lispy-occur) ;; `lispy-x' -> q + + (lispy-define-key map "r" 'lispy-raise) + (lispy-define-key map "R" 'lispy-raise-some) + + (lispy-define-key map "+" 'lispy-join) ;; Hmnn this can be something else. + + ;; more transformations + (lispy-define-key map "C" 'lispy-convolute) + (lispy-define-key map "X" 'lispy-convolute-left) + (lispy-define-key map "w" 'lispy-move-up) + (lispy-define-key map "s" 'lispy-move-down) + (lispy-define-key map "O" 'lispy-oneline) + (lispy-define-key map "M" 'lispy-alt-multiline) + (lispy-define-key map "S" 'lispy-stringify) + + ;; marking + (lispy-define-key map "a" 'lispy-ace-symbol + :override '(cond ((looking-at lispy-outline) + (lispy-meta-return)))) + (lispy-define-key map "H" 'lispy-ace-symbol-replace) + (lispy-define-key map "m" 'lispy-view) ;; `lispy-mark-list' -> v + + ;; dialect-specific + (lispy-define-key map "e" 'lispy-eval) + (lispy-define-key map "E" 'lispy-eval-and-insert) + + ;; Hmnn, not sure why there's no `lispy-end-of-defun'. + ;; `end-of-defun' doesn't work quite right yet. It exits the list + ;; which would exit lispy state. + (lispy-define-key map "G" 'end-of-defun) ;; `lispy-goto-local' -> gl + + (lispy-define-key map "A" 'evil-collection-lispy-insert-at-end-of-list) ;; `lispy-beginning-of-defun' -> gg + (lispy-define-key map "I" 'evil-collection-lispy-insert-at-beginning-of-list) ;; `lispy-shifttab' -> zs + + (lispy-define-key map "F" 'lispy-follow t) + (lispy-define-key map "D" 'pop-tag-mark) + (lispy-define-key map "_" 'lispy-underscore) + ;; miscellanea + (define-key map (kbd "SPC") 'lispy-space) + (lispy-define-key map "z" 'lispy-tab-hydra/body) ;; `lh-knight/body' -> g + + (lispy-define-key map "N" 'lispy-narrow) + (lispy-define-key map "W" 'lispy-widen) + (lispy-define-key map "c" 'lispy-clone) + (lispy-define-key map "u" 'lispy-undo) + + (lispy-define-key map "q" 'lispy-x) ;; `lispy-ace-paren' -> f + (lispy-define-key map "Q" 'lispy-other-mode) ;; `lispy-ace-char' -> t + (lispy-define-key map "v" 'lispy-mark-list) ;; `lispy-view' -> m + (lispy-define-key map "t" 'lispy-ace-char) ;; `lispy-teleport' -> T + (lispy-define-key map "n" 'lispy-flow) ;; `lispy-new-copy' -> y + (lispy-define-key map "b" 'lispy-back) + + (lispy-define-key map "B" 'lispy-ediff-regions) + (lispy-define-key map "x" 'lispy-splice) ;; `lispy-x' -> q + + (lispy-define-key map "Z" 'lispy-edebug-stop) + (lispy-define-key map "V" 'lispy-visit) + (lispy-define-key map "-" 'lispy-ace-subword) + (lispy-define-key map "." 'lispy-repeat) + (lispy-define-key map "~" 'lispy-tilde) + ;; digit argument + (mapc (lambda (x) (lispy-define-key map (format "%d" x) 'digit-argument)) + (number-sequence 0 9)) + + ;; additional + (lispy-define-key map "T" 'lispy-teleport + :override '(cond ((looking-at lispy-outline) + (end-of-line)))) + (lispy-define-key map "C-J" 'lispy-outline-next) ;; Hmnn... + (lispy-define-key map "C-K" 'lispy-outline-prev) ;; Hmnn... + (lispy-define-key map "]" 'lispy-forward) + (lispy-define-key map "[" 'lispy-backward) + (lispy-define-key map "{" 'lispy-brackets) + + ;; Experimental + (lispy-define-key map "^" 'lispy-splice-sexp-killing-backward) + (lispy-define-key map "$" 'lispy-splice-sexp-killing-forward) + map) + "`evil' flavored `lispy' bindings when in special state.") + +(defvar evil-collection-lispy-mode-map-evil + (let ((map (copy-keymap lispy-mode-map-base))) + (define-key map (kbd "M-)") 'lispy-wrap-round) + (define-key map (kbd "M-s") 'lispy-splice) + (define-key map (kbd "M-<up>") 'lispy-splice-sexp-killing-backward) + (define-key map (kbd "M-<down>") 'lispy-splice-sexp-killing-forward) + + (define-key map (kbd "M-r") 'lispy-raise-sexp) + (define-key map (kbd "M-R") 'lispy-raise-some) + (define-key map (kbd "M-C") 'lispy-convolute-sexp) + (define-key map (kbd "M-S") 'lispy-split) + (define-key map (kbd "M-J") 'lispy-join) + (define-key map (kbd "]") 'lispy-forward) + (define-key map (kbd "[") 'lispy-backward) + (define-key map (kbd "M-(") 'lispy-wrap-round) + (define-key map (kbd "M-{") 'lispy-wrap-braces) + (define-key map (kbd "M-}") 'lispy-wrap-braces) + (define-key map (kbd "<") 'lispy-slurp-or-barf-left) + (define-key map (kbd ">") 'lispy-slurp-or-barf-right) + (define-key map (kbd "M-y") 'lispy-new-copy) + (define-key map (kbd "<C-return>") 'lispy-open-line) + (define-key map (kbd "<M-return>") 'lispy-meta-return) + (define-key map (kbd "M-k") 'lispy-move-up) + (define-key map (kbd "M-j") 'lispy-move-down) + (define-key map (kbd "M-o") 'lispy-string-oneline) + (define-key map (kbd "M-p") 'lispy-clone) + (define-key map (kbd "M-d") 'lispy-delete) + map) + "`evil' flavored `lispy-mode' bindings.") + +(defun evil-collection-lispy-set-key-theme (theme) + "Set `lispy-mode-map' for according to THEME. +THEME is a list of choices: 'special, 'lispy, 'paredit, 'evilcp, +'c-digits', 'special-evil', 'evil'. + +This is an exact copy of `lispy-set-key-theme' except with the additions of +'special-evil' and 'evil' themes." + (setq lispy-mode-map + (make-composed-keymap + (delq nil + (list + (when (memq 'special-evil theme) evil-collection-lispy-mode-map-special-evil) + (when (memq 'evil theme) evil-collection-lispy-mode-map-evil) + (when (memq 'special theme) lispy-mode-map-special) + (when (memq 'lispy theme) lispy-mode-map-lispy) + (when (memq 'paredit theme) lispy-mode-map-paredit) + (when (memq 'parinfer theme) lispy-mode-map-parinfer) + (when (memq 'evilcp theme) lispy-mode-map-evilcp) + (when (memq 'c-digits theme) lispy-mode-map-c-digits) + (when (memq 'oleh theme) lispy-mode-map-oleh))))) + (setcdr + (assq 'lispy-mode minor-mode-map-alist) + lispy-mode-map)) + +;;;###autoload +(defun evil-collection-lispy-setup () + "Set up `evil' bindings for `lispy'." + (advice-add 'lispy-set-key-theme :override 'evil-collection-lispy-set-key-theme) + (lispy-set-key-theme '(special-evil evil))) + +(provide 'evil-collection-lispy) +;;; evil-collection-lispy.el ends here diff --git a/modes/log-edit/evil-collection-log-edit.el b/modes/log-edit/evil-collection-log-edit.el new file mode 100644 index 0000000..4f852a6 --- /dev/null +++ b/modes/log-edit/evil-collection-log-edit.el @@ -0,0 +1,57 @@ +;;; evil-collection-log-edit.el --- Evil bindings for log-edit -*- lexical-binding: t -*- + +;; Copyright (C) 2019 James Nguyen + +;; Author: James Nguyen <james@jojojames.com> +;; 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 "25.1")) +;; Keywords: evil, log-edit, 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 log-edit. + +;;; Code: +(require 'evil-collection) +(require 'log-edit nil t) + +(defvar log-edit-mode-map) + +(defconst evil-collection-log-edit-maps '(log-edit-mode-map)) + +;;;###autoload +(defun evil-collection-log-edit-setup () + "Set up `evil' bindings for `log-edit'." + (evil-collection-define-key nil 'log-edit-mode-map + [remap evil-save-and-close] 'log-edit-done + [remap evil-save-modified-and-close] 'log-edit-done + [remap evil-quit] 'log-edit-kill-buffer) + + (evil-collection-define-key 'normal 'log-edit-mode-map + "g?" 'log-edit-mode-help + "]]" 'log-edit-next-comment + "[[" 'log-edit-previous-comment + "gj" 'log-edit-next-comment + "gk" 'log-edit-previous-comment + (kbd "C-j") 'log-edit-next-comment + (kbd "C-k") 'log-edit-next-comment + + "ZQ" 'quit-window + "ZZ" 'quit-window)) + +(provide 'evil-collection-log-edit) +;;; evil-collection-log-edit.el ends here diff --git a/modes/magit-todos/evil-collection-magit-todos.el b/modes/magit-todos/evil-collection-magit-todos.el new file mode 100644 index 0000000..0f929e6 --- /dev/null +++ b/modes/magit-todos/evil-collection-magit-todos.el @@ -0,0 +1,53 @@ +;;; evil-collection-magit-todos.el --- Bindings for `magit-todos' -*- lexical-binding: t -*- + +;; Copyright (C) 2018 James Nguyen + +;; Author: Fredrik Bergroth <fbergroth@gmail.com> +;; 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 "25.1")) +;; Keywords: evil, emacs, tools + +;; This program 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 of the License, or +;; (at your option) any later version. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;; Bindings for `magit-todos'. + +;;; Code: +(require 'evil-collection) +(require 'magit-todos nil t) + +(defconst evil-collection-magit-todos-maps '(magit-todos-section-map + magit-status-mode-map)) + +(defun evil-collection-magit-todos-setup-jump-key () + "Add keybinding to jump to todos section." + (evil-collection-define-key 'normal 'magit-status-mode-map + "gT" (and (bound-and-true-p magit-todos-mode) 'magit-todos-jump-to-todos))) + + +;;;###autoload +(defun evil-collection-magit-todos-setup () + "Set up `evil' bindings for `magit-todos'." + ;; magit-todos binds jT which prevents evil users from stepping into the section + (evil-collection-define-key nil 'magit-todos-section-map + "j" nil) + + (add-hook 'magit-todos-mode-hook 'evil-collection-magit-todos-setup-jump-key)) + + +(provide 'evil-collection-magit-todos) +;;; evil-collection-magit-todos.el ends here diff --git a/modes/monky/evil-collection-monky.el b/modes/monky/evil-collection-monky.el new file mode 100644 index 0000000..6bc87e0 --- /dev/null +++ b/modes/monky/evil-collection-monky.el @@ -0,0 +1,129 @@ +;;; evil-collection-monky.el --- Bindings for `monky'. -*- lexical-binding: t -*- + +;; Copyright (C) 2019 James Nguyen + +;; Author: James Nguyen <james@jojojames.com> +;; 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 "25.1")) +;; Keywords: emacs, tools + +;; This program 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 of the License, or +;; (at your option) any later version. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;;; Bindings for `monky'. + +;;; Code: +(require 'evil-collection) +(require 'monky nil t) + +(defconst evil-collection-monky-maps '(monky-mode-map + monky-status-mode-map + monky-log-mode-map + monky-blame-mode-map + monky-branches-mode-map + monky-commit-mode-map + monky-queue-mode-map + monky-log-edit-mode-map)) + +;;;###autoload +(defun evil-collection-monky-setup () + "Set up `evil' bindings for `monky'." + (evil-set-initial-state 'monky-mode 'normal) + (add-hook 'monky-mode-hook 'evil-normalize-keymaps) + (add-hook 'monky-status-mode-hook 'evil-normalize-keymaps) + + (evil-collection-define-key 'normal 'monky-mode-map + "]]" 'monky-goto-next-section + "gj" 'monky-goto-next-section + (kbd "C-j") 'monky-goto-next-section + "[[" 'monky-goto-previous-section + "gk" 'monky-goto-previous-section + (kbd "C-k") 'monky-goto-previous-section + (kbd "RET") 'monky-visit-item + (kbd "TAB") 'monky-toggle-section + (kbd "SPC") 'monky-show-item-or-scroll-up + (kbd "DEL") 'monky-show-item-or-scroll-down + "gr" 'monky-refresh + "`" 'monky-display-process + "!" 'monky-hg-command + "Ll" 'monky-log-current-branch + "La" 'monky-log-all + "LL" 'monky-log-all + "Lr" 'monky-log-revset + "b" 'monky-branches + "Q" 'monky-queue + "q" 'monky-quit-window) + + (evil-collection-define-key 'normal 'monky-status-mode-map + "s" 'monky-stage-item + "S" 'monky-stage-all + "u" 'monky-unstage-item + "U" 'monky-unstage-all + "a" 'monky-commit-amend + "c" 'monky-log-edit + "e" 'monky-ediff-item + "Y" 'monky-bookmark-create + "C" 'monky-checkout + "M" 'monky-merge + "B" 'monky-backout + "P" 'monky-push + "F" 'monky-pull + "x" 'monky-discard-item + "m" 'monky-resolve-item + "K" 'monky-unresolve-item ;; Not the best... + "o" 'monky-reset-tip + "A" 'monky-addremove-all + "R" 'monky-rollback) + + (evil-collection-define-key 'normal 'monky-log-mode-map + "+" 'monky-log-show-more-entries + "b" 'monky-checkout-item ;; Like `magit-branch'. + "m" 'monky-merge-item ;; Like `magit-merge'. + "B" 'monky-backout-item + "i" 'monky-qimport-item) + + (evil-collection-define-key 'normal 'monky-branches-mode-map + "b" 'monky-checkout-item ;; Like `magit-branch'. + "m" 'monky-merge-item ;; Like `magit-merge'. + ) + + ;; FIXME: Haven't used this mode yet so not sure if these are appropriate... + (evil-collection-define-key 'normal 'monky-queue-mode-map + "u" 'monky-qpop-item + "U" 'monky-qpop-all + "s" 'monky-qpush-item + "S" 'monky-qpush-all + "r" 'monky-qrefresh + "R" 'monky-qrename-item + "k" 'monky-qremove-item + "N" 'monky-qnew + "f" 'monky-qfinish-item + "F" 'monky-qfinish-applied + "d" 'monky-qfold-item + "G" 'monky-qguard-item + "o" 'monky-qreorder + "A" 'monky-addremove-all) + + (evil-collection-define-key 'normal 'monky-log-edit-mode-map + (kbd "C-c C-c") 'monky-log-edit-commit + [remap evil-save-and-close] 'monky-log-edit-commit + [remap evil-save-modified-and-close] 'monky-log-edit-commit + (kbd "C-c C-k") 'monky-log-edit-cancel-log-message + [remap evil-quit] 'monky-log-edit-cancel-log-message)) + +(provide 'evil-collection-monky) +;;; evil-collection-monky.el ends here diff --git a/modes/omnisharp/evil-collection-omnisharp.el b/modes/omnisharp/evil-collection-omnisharp.el new file mode 100644 index 0000000..96bf4fd --- /dev/null +++ b/modes/omnisharp/evil-collection-omnisharp.el @@ -0,0 +1,44 @@ +;;; evil-collection-omnisharp.el --- Evil bindings for omnisharp -*- lexical-binding: t -*- + +;; Copyright (C) 2019 Omair Majid + +;; Author: Omair Majid <omajid@redhat.com> +;; 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 "25.1")) +;; Keywords: evil, omnisharp, convenience + +;; This program 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 of the License, or +;; (at your option) any later version. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;; Evil bindings for Omnisharp. + +;;; Code: +(require 'omnisharp nil t) +(require 'evil-collection) + +(defconst evil-collection-omnisharp-maps '(omnisharp-mode-map)) + +;;;###autoload +(defun evil-collection-omnisharp-setup () + "Set up `evil' bindings for `omnisharp'." + (evil-collection-define-key '(normal visual) 'omnisharp-mode-map + "gd" 'omnisharp-go-to-definition + "gR" 'omnisharp-reload-solution + "K" 'omnisharp-current-type-documentation)) + +(provide 'evil-collection-omnisharp) +;;; evil-collection-omnisharp.el ends here diff --git a/modes/process-menu/evil-collection-process-menu.el b/modes/process-menu/evil-collection-process-menu.el new file mode 100644 index 0000000..f8ce72b --- /dev/null +++ b/modes/process-menu/evil-collection-process-menu.el @@ -0,0 +1,59 @@ +;;; evil-collection-process-menu.el --- Evil bindings for process-menu-mode -*- lexical-binding: t -*- + +;; Copyright (C) 2019 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 "25.1")) +;; Keywords: evil, process, 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 process-menu-mode (M-x list-processes). + +;;; Code: +(require 'evil-collection) + +(defconst evil-collection-process-menu-maps '(process-menu-mode-map)) + +;;;###autoload +(defun evil-collection-process-menu-setup () + "Set up `evil' bindings for `list-processes'." + (evil-collection-inhibit-insert-state 'process-menu-mode-map) + (evil-collection-define-key 'normal 'process-menu-mode-map + (kbd "<tab>") 'forward-button + (kbd "<backtab>") 'backward-button + + "S" 'tabulated-list-sort + "D" 'process-menu-delete-process + + ;; motion + ;; TODO: Implement beginning-of-buffer / end-of-buffer. + (kbd "SPC") 'evil-scroll-down + (kbd "S-SPC") 'evil-scroll-up + + ;; refresh + "gr" 'revert-buffer + + ;; quit + "q" 'quit-window + "ZQ" 'evil-quit + "ZZ" 'quit-window)) + +(provide 'evil-collection-process-menu) +;;; evil-collection-process-menu.el ends here diff --git a/modes/restclient/evil-collection-restclient.el b/modes/restclient/evil-collection-restclient.el new file mode 100644 index 0000000..4a64f69 --- /dev/null +++ b/modes/restclient/evil-collection-restclient.el @@ -0,0 +1,60 @@ +;;; evil-collection-restclient.el --- Bindings for `restclient'. -*- lexical-binding: t -*- + +;; Copyright (C) 2018 James Nguyen + +;; Author: James Nguyen <james@jojojames.com> +;; Maintainer: James Nguyen <james@jojojames.com> +;; Pierre Neidhardt <mail@ambrevar.xyz> +;; URL: https://github.com/emacs-evil/evil-collection +;; Version: 0.0.2 +;; Package-Requires: ((emacs "25.1")) +;; Keywords: evil, emacs, tools + +;; This program 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 of the License, or +;; (at your option) any later version. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;;; Bindings for `restclient'. + +;;; Code: +(require 'evil-collection) +(require 'restclient nil t) + +(defconst evil-collection-restclient-maps + '(evil-collection-restclient-mode-map)) + +(defvar evil-collection-restclient-mode-map (make-sparse-keymap)) + +(define-minor-mode evil-collection-restclient-result-mode + "A minor mode to attach to `restclient' results" + :group 'evil-collection-restclient-mode + :keymap evil-collection-restclient-mode-map + :lighter nil) + +(defun evil-collection-restclient-setup-result-mode () + "Set up `evil-collection-restclient-result-mode'." + (evil-collection-restclient-result-mode) + (evil-normalize-keymaps)) + +;;;###autoload +(defun evil-collection-restclient-setup () + "Set up `evil' bindings for `restclient'." + ;; Enable a separate minor mode so that we can bind keys to it. + (evil-collection-define-key 'normal 'evil-collection-restclient-mode-map + "q" 'quit-window) + + (add-hook 'restclient-response-loaded-hook + #'evil-collection-restclient-setup-result-mode)) + +(provide 'evil-collection-restclient) +;;; evil-collection-restclient.el ends here diff --git a/modes/tetris/evil-collection-tetris.el b/modes/tetris/evil-collection-tetris.el new file mode 100644 index 0000000..9583cea --- /dev/null +++ b/modes/tetris/evil-collection-tetris.el @@ -0,0 +1,56 @@ +;;; evil-collection-tetris.el --- Bindings for `tetris' -*- lexical-binding: t -*- + +;; Copyright (C) 2018 James Nguyen + +;; Author: MaxSt +;; 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 "25.1")) +;; Keywords: evil, emacs, tools + +;; This program 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 of the License, or +;; (at your option) any later version. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;; Bindings for `tetris'. + +;;; Code: +(require 'evil-collection) +(require 'tetris nil t) + +(defconst evil-collection-tetris-maps '(tetris-mode-map)) + +;;;###autoload +(defun evil-collection-tetris-setup () + "Set up `evil' bindings for `tetris'." + (evil-set-initial-state 'tetris-mode 'normal) + (evil-collection-define-key 'normal 'tetris-mode-map + "h" 'tetris-move-left + "l" 'tetris-move-right + "k" 'tetris-rotate-next + "K" 'tetris-rotate-prev + "j" 'tetris-move-down + "J" 'tetris-move-bottom + "G" 'tetris-move-bottom + "gr" 'tetris-start-game + (kbd "TAB") 'tetris-move-bottom + "p" 'tetris-pause-game + "q" 'quit-window + "ZQ" 'quit-window + "ZZ" 'tetris-end-game + (kbd "<escape>") 'quit-window)) + +(provide 'evil-collection-tetris) +;;; evil-collection-tetris.el ends here diff --git a/modes/unimpaired/evil-collection-unimpaired.el b/modes/unimpaired/evil-collection-unimpaired.el new file mode 100644 index 0000000..f4b1b53 --- /dev/null +++ b/modes/unimpaired/evil-collection-unimpaired.el @@ -0,0 +1,89 @@ +;;; evil-collection-unimpaired.el --- Evil Collection port of Unimpaired -*- lexical-binding: t -*- + +;; Copyright (C) 2019 James Nguyen + +;; Author: James Nguyen <james@jojojames.com> +;; 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 "25.1")) +;; Keywords: evil, unimpaired, tools + +;; This program 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 of the License, or +;; (at your option) any later version. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;; `evil' port of unimpaired for `evil-collection'. +;; https://github.com/tpope/vim-unimpaired + +;;; Code: +(require 'evil-collection) + +(defconst evil-collection-unimpaired-maps '(evil-collection-unimpaired-mode-map)) + +(defvar evil-collection-unimpaired-mode-map (make-sparse-keymap) + "Keymap for `evil-collection-unimpaired-mode'.") + +(define-minor-mode evil-collection-unimpaired-mode + "" + nil + nil + evil-collection-unimpaired-mode-map) + +;;;###autoload +(define-global-minor-mode global-evil-collection-unimpaired-mode + evil-collection-unimpaired-mode evil-collection-unimpaired-mode-on) + +(defun evil-collection-unimpaired-mode-on () + "Turn on `evil-collection-unimpaired-mode'." + (evil-collection-unimpaired-mode 1)) + +(defun evil-collection-unimpaired-next-error () + "Go to next error." + (interactive) + (cond + ((and (bound-and-true-p flycheck-mode) + (fboundp 'flycheck-next-error)) + (flycheck-next-error)) + ((and (bound-and-true-p flymake-mode) + (fboundp 'flymake-goto-next-error)) + (flymake-goto-next-error)) + (:default + (message "No linting modes are on.")))) + +(defun evil-collection-unimpaired-previous-error () + "Go to previous error." + (interactive) + (cond + ((and (bound-and-true-p flycheck-mode) + (fboundp 'flycheck-previous-error)) + (flycheck-previous-error)) + ((and (bound-and-true-p flymake-mode) + (fboundp 'flymake-goto-prev-error)) + (flymake-goto-prev-error)) + (:default + (message "No linting modes are on.")))) + +;;;###autoload +(defun evil-collection-unimpaired-setup () + "Set up unimpaired-like bindings." + (global-evil-collection-unimpaired-mode 1) + (evil-collection-define-key 'normal 'evil-collection-unimpaired-mode-map + "[b" 'previous-buffer + "]b" 'next-buffer + "]l" 'evil-collection-unimpaired-next-error + "[l" 'evil-collection-unimpaired-previous-error)) + +(provide 'evil-collection-unimpaired) +;;; evil-collection-unimpaired.el ends here diff --git a/modes/vc-dir/evil-collection-vc-dir.el b/modes/vc-dir/evil-collection-vc-dir.el new file mode 100644 index 0000000..65b3e96 --- /dev/null +++ b/modes/vc-dir/evil-collection-vc-dir.el @@ -0,0 +1,112 @@ +;;; evil-collection-vc-dir.el --- Evil bindings for Vc-Dir -*- lexical-binding: t -*- + +;; Copyright (C) 2017 James Nguyen + +;; Author: James Nguyen <james@jojojames.com> +;; Maintainer: James Nguyen <james@jojojames.com> +;; Pierre Neidhardt <ambrevar@gmail.com> +;; URL: https://github.com/emacs-evil/evil-collection +;; Version: 0.0.1 +;; Package-Requires: ((emacs "25.1")) +;; Keywords: evil, vc-dir, tools + +;; This program 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 of the License, or +;; (at your option) any later version. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;; Evil bindings for Vc-Dir. + +;;; Code: +(require 'vc-dir) +(require 'evil-collection) + +(defconst evil-collection-vc-dir-maps '(vc-dir-mode-map)) + +;;;###autoload +(defun evil-collection-vc-dir-setup () + "Set up `evil' bindings for `vc-dir'." + (evil-set-initial-state 'vc-dir-mode 'normal) + (evil-collection-define-key 'normal 'vc-dir-mode-map + ;; VC commands + "c" 'vc-next-action + + "d" 'vc-diff + "D" 'vc-root-diff + "\t" 'vc-diff + [backtab] 'vc-root-diff + + "R" 'vc-register + "s" 'vc-register ;; Like `magit-stage'? + "gu" 'vc-update + "gr" 'revert-buffer + + "F" 'vc-update ;; This is the same as `vc-update' bound to "gu". + "p" 'vc-push + "P" 'vc-push + + "Lf" 'vc-print-log ;; Log File. + "Ll" 'vc-print-log + "Lr" 'vc-print-root-log + "LL" 'vc-print-root-log + "Li" 'vc-log-incoming + "Lo" 'vc-log-outgoing + + "x" 'vc-revert + "b" 'vc-annotate ;; Like `magit-blame' + + ;; Marking. + "m" 'vc-dir-mark + "M" 'vc-dir-mark-all-files + "u" 'vc-dir-unmark + "U" 'vc-dir-unmark-all-files + + ;; Rebind paragraph-movement commands. + "]]" 'vc-dir-next-directory + "[[" 'vc-dir-previous-directory + "gj" 'vc-dir-next-directory + "gk" 'vc-dir-previous-directory + (kbd "C-j") 'vc-dir-next-directory + (kbd "C-k") 'vc-dir-previous-directory + + ;; The remainder. + "gf" 'vc-dir-find-file + "\C-m" 'vc-dir-find-file + + (kbd "S-<return>") 'vc-dir-find-file-other-window + "go" 'vc-dir-find-file-other-window + "gO" 'vc-dir-display-file + (kbd "M-<return>") 'vc-dir-display-file + + "\C-c\C-c" 'vc-dir-kill-dir-status-process + [down-mouse-3] 'vc-dir-menu + [mouse-2] 'vc-dir-find-file-other-window + "t" 'vc-dir-toggle-mark + [follow-link] 'mouse-face + + "(" 'vc-dir-hide-up-to-date + "o" 'vc-dir-hide-up-to-date + + "X" 'vc-dir-kill-line + "S" 'vc-dir-search + "Q" 'vc-dir-query-replace-regexp + (kbd "M-s a C-s") 'vc-dir-isearch + (kbd "M-s a M-C-s") 'vc-dir-isearch-regexp + "i" 'vc-dir-ignore + + ;; Branching + "Bc" 'vc-create-tag + "Bl" 'vc-print-branch-log + "Bs" 'vc-retrieve-tag)) + +(provide 'evil-collection-vc-dir) +;;; evil-collection-vc-dir.el ends here diff --git a/modes/vterm/evil-collection-vterm.el b/modes/vterm/evil-collection-vterm.el new file mode 100644 index 0000000..abe0399 --- /dev/null +++ b/modes/vterm/evil-collection-vterm.el @@ -0,0 +1,109 @@ +;;; evil-collection-vterm.el --- Bindings for `vterm'. -*- lexical-binding: t -*- + +;; Copyright (C) 2019 James Nguyen + +;; Author: James Nguyen <james@jojojames.com> +;; 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 "25.1")) +;; Keywords: evil, vterm, tools + +;; This program 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 of the License, or +;; (at your option) any later version. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;;; Bindings for `vterm'. + +;;; Code: +(require 'evil-collection) +(require 'vterm nil t) + +(defconst evil-collection-vterm-maps '(vterm-mode-map)) + +(defvar vterm--process) + +(defun evil-collection-vterm-escape-stay () + "Go back to normal state but don't move cursor backwards. +Moving cursor backwards is the default vim behavior but +it is not appropriate in some cases like terminals." + (setq-local evil-move-cursor-back nil)) + +(defun evil-collection-vterm-exit-function (buffer) + "Automatically kill `vterm' buffer on exit." + (when buffer + (kill-buffer buffer))) + +(defvar-local evil-collection-vterm-send-escape-to-vterm-p nil + "Track whether or not we send ESC to `vterm' or `emacs'.") + +(defun evil-collection-vterm-toggle-send-escape () + "Toggle where ESC is sent between `vterm' and `emacs'. + +This is needed for programs that use ESC, e.g. vim or an ssh'd emacs that +also uses `evil-mode'." + (interactive) + (if evil-collection-vterm-send-escape-to-vterm-p + (evil-collection-define-key 'insert 'vterm-mode-map (kbd "<escape>") + (lookup-key evil-insert-state-map (kbd "<escape>"))) + (evil-collection-define-key 'insert 'vterm-mode-map + (kbd "<escape>") 'vterm--self-insert)) + (setq evil-collection-vterm-send-escape-to-vterm-p + (not evil-collection-vterm-send-escape-to-vterm-p)) + (message (format "Sending ESC to %s." + (if evil-collection-vterm-send-escape-to-vterm-p + "vterm" + "emacs")))) + +;;;###autoload +(defun evil-collection-vterm-setup () + "Set up `evil' bindings for `vterm'." + (evil-set-initial-state 'vterm-mode 'insert) + + (add-hook 'vterm-mode-hook #'evil-collection-vterm-escape-stay) + (add-hook 'vterm-exit-functions #'evil-collection-vterm-exit-function) + + ;; Open to a better binding... + (evil-collection-define-key '(normal insert) 'vterm-mode-map + (kbd "C-c C-z") 'evil-collection-vterm-toggle-send-escape) + + ;; Evil has some "C-" bindings in insert state that shadow regular terminal + ;; bindings. Don't raw-send "C-c" (prefix key) nor "C-h" (help prefix). + (evil-collection-define-key 'insert 'vterm-mode-map + (kbd "C-a") 'vterm--self-insert + (kbd "C-b") 'vterm--self-insert ; Should not be necessary. + (kbd "C-d") 'vterm--self-insert + (kbd "C-e") 'vterm--self-insert + (kbd "C-f") 'vterm--self-insert ; Should not be necessary. + (kbd "C-k") 'vterm--self-insert + (kbd "C-l") 'vterm--self-insert ; Should not be necessary. + (kbd "C-n") 'vterm--self-insert + (kbd "C-o") 'vterm--self-insert + (kbd "C-p") 'vterm--self-insert + (kbd "C-q") 'vterm--self-insert ; Should not be necessary. + (kbd "C-r") 'vterm--self-insert + (kbd "C-s") 'vterm--self-insert ; Should not be necessary. + (kbd "C-t") 'vterm--self-insert + (kbd "C-u") 'vterm--self-insert ; Should not be necessary. + (kbd "C-v") 'vterm--self-insert ; Should not be necessary. + (kbd "C-w") 'vterm--self-insert + (kbd "C-y") 'vterm--self-insert + (kbd "C-z") 'vterm--self-insert) + + (evil-collection-define-key 'normal 'vterm-mode-map + "p" 'vterm-yank + "u" 'vterm-undo)) + +(provide 'evil-collection-vterm) +;;; evil-collection-vterm.el ends here diff --git a/modes/w3m/evil-collection-w3m.el b/modes/w3m/evil-collection-w3m.el new file mode 100644 index 0000000..afd2f87 --- /dev/null +++ b/modes/w3m/evil-collection-w3m.el @@ -0,0 +1,100 @@ +;;; evil-collection-w3m.el --- Evil bindings for w3m -*- lexical-binding: t -*- + +;; Copyright (C) 2018 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 "25.1")) +;; Keywords: evil, w3m, 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 `w3m'. + +;;; Code: +(require 'evil-collection) +(require 'w3m nil t) + +(defconst evil-collection-w3m-maps '(w3m-mode-map)) + +;;;###autoload +(defun evil-collection-w3m-setup () + "Set up `evil' bindings for `w3m'." + (evil-set-initial-state 'w3m-mode 'normal) + (evil-collection-define-key 'normal 'w3m-mode-map + (kbd "S-SPC") 'w3m-scroll-down-or-previous-url + (kbd "SPC") 'w3m-scroll-up-or-next-url + + (kbd "RET") 'w3m-view-this-url + "o" 'w3m-goto-url + "O" 'w3m-goto-url-new-session + + "]]" 'w3m-next-form + "[[" 'w3m-previous-form + + "H" 'w3m-view-previous-page + "L" 'w3m-view-next-page + "^" 'w3m-view-parent-page + + "gf" 'w3m-view-source + "gh" 'w3m-view-header + + "d" 'w3m-download-this-url + "M-d" 'w3m-download + + "I" 'w3m-view-image + "M-i" 'w3m-save-image + "zi" 'w3m-toggle-inline-image + "zI" 'w3m-toggle-inline-images + "M-T" 'w3m-turnoff-inline-images + + ;; bookmarks + "gb" 'w3m-bookmark-view + "gB" 'w3m-bookmark-view-new-session + "a" 'w3m-bookmark-add-current-url + + ;; refresh + "gr" 'w3m-reload-this-page + "gR" 'w3m-reload-all-pages + + ;; quit + "q" 'w3m-close-window + "ZQ" 'w3m-quit + "ZZ" 'quit-window) + + (evil-collection-define-key 'operator 'w3m-mode-map + "t" '(menu-item + "" + nil + :filter (lambda (&optional _) + (when (memq evil-this-operator + evil-collection-yank-operators) + (setq evil-inhibit-operator t) + #'w3m-print-this-url)))) + (evil-collection-define-key 'operator 'w3m-mode-map + "u" '(menu-item + "" + nil + :filter (lambda (&optional _) + (when (memq evil-this-operator + evil-collection-yank-operators) + (setq evil-inhibit-operator t) + #'w3m-print-current-url))))) + +(provide 'evil-collection-w3m) +;;; evil-collection-w3m.el ends here diff --git a/modes/youtube/evil-collection-youtube-dl.el b/modes/youtube/evil-collection-youtube-dl.el new file mode 100644 index 0000000..af47fe2 --- /dev/null +++ b/modes/youtube/evil-collection-youtube-dl.el @@ -0,0 +1,72 @@ +;;; evil-collection-youtube-dl.el --- Evil bindings for youtube-dl -*- lexical-binding: t -*- + +;; Copyright (C) 2018 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 "25.1")) +;; Keywords: evil, youtube, 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 youtube-dl. + +;;; Code: +(require 'evil-collection) +(require 'youtube-dl nil t) + +(defvar youtube-dl-list-mode-map) + +(defconst evil-collection-youtube-dl-maps '(youtube-dl-list-mode-map)) + +;;;###autoload +(defun evil-collection-youtube-dl-setup () + "Set up `evil' bindings for `youtube-dl'." + + (evil-collection-inhibit-insert-state 'youtube-dl-list-mode-map) + (evil-collection-define-key 'normal 'youtube-dl-list-mode-map + (kbd "S-SPC") 'scroll-down-command + + "gr" 'youtube-dl-list-redisplay + + "g?" 'describe-mode + + "p" 'youtube-dl-list-toggle-pause + "s" 'youtube-dl-list-toggle-slow + "S" 'youtube-dl-list-toggle-slow-all + "y" 'youtube-dl-list-yank + + "i" 'youtube-dl-list-log + "I" 'youtube-dl-list-kill-log + + "a" 'youtube-dl + "d" 'youtube-dl-list-kill + + "[[" 'youtube-dl-list-priority-down + "]]" 'youtube-dl-list-priority-up + "gj" 'youtube-dl-list-priority-down + "gk" 'youtube-dl-list-priority-up + (kbd "C-j") 'youtube-dl-list-priority-down + (kbd "C-k") 'youtube-dl-list-priority-up + + ;; quit + "q" 'quit-window + "ZQ" 'evil-quit + "ZZ" 'evil-quit)) + +(provide 'evil-collection-youtube-dl) +;;; evil-collection-youtube-dl.el ends here |
