Merge branch 'emacs-evil:master' into master

This commit is contained in:
wickedjargon 2021-12-01 13:05:32 -05:00 committed by GitHub
commit ea6465ca0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 167 additions and 21 deletions

View File

@ -165,6 +165,7 @@ This will bind additional find-* type commands, e.g. usages, assignments, etc.."
finder
flycheck
flymake
forge
free-keys
geiser
ggtags
@ -239,6 +240,7 @@ This will bind additional find-* type commands, e.g. usages, assignments, etc.."
robe
rtags
ruby-mode
scheme
scroll-lock
selectrum
sh-script

View File

@ -1,6 +1,6 @@
;;; evil-collection-eshell.el --- Evil bindings for Eshell -*- lexical-binding: t -*-
;; Copyright (C) 2017 Pierre Neidhardt
;; Copyright (C) 2017, 2021 Pierre Neidhardt
;; Author: Pierre Neidhardt <mail@ambrevar.xyz>
;; Maintainer: James Nguyen <james@jojojames.com>
@ -51,6 +51,12 @@
(eshell-interrupt-process)
(evil-insert 1))
(defun evil-collection-eshell-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))
;; Taken from Doom Emacs
(evil-define-operator evil-collection-eshell-evil-change (beg end type register yank-handler delete-func)
"Like `evil-change' but will not delete/copy the prompt."
@ -79,7 +85,10 @@
type register yank-handler)))
;; Taken from Doom Emacs
;; Although the BEG argument doesn't get used in any meaningful way, `evil-define-operator' must access it nonetheless, so putting an underscore in front will make the CI fail.
;;
;; Although the BEG argument doesn't get used in any meaningful way,
;; `evil-define-operator' must access it nonetheless, so putting an underscore
;; in front will make the CI fail.
(evil-define-operator evil-collection-eshell-evil-delete-line (beg end type register yank-handler)
"Change to end of line."
:motion nil
@ -87,8 +96,8 @@
(interactive "<R><x>")
(evil-collection-eshell-evil-delete (point) end type register yank-handler))
;;; `eshell-mode-map' is reset when Eshell is initialized in `eshell-mode'. We
;;; need to add bindings to `eshell-first-time-mode-hook'.
;; `eshell-mode-map' is reset when Eshell is initialized in `eshell-mode'. We
;; need to add bindings to `eshell-first-time-mode-hook'.
(defun evil-collection-eshell-setup-keys ()
"Set up `evil' bindings for `eshell'."
(evil-collection-define-key 'normal 'eshell-mode-map
@ -113,14 +122,11 @@
"C" 'evil-collection-eshell-evil-change-line
"d" 'evil-collection-eshell-evil-delete
"D" 'evil-collection-eshell-evil-delete-line)
(evil-collection-define-key 'insert 'eshell-mode-map
;; motion
(kbd "M-h") 'eshell-backward-argument
(kbd "M-l") 'eshell-forward-argument)
;; TODO: What if the user changes `evil-want-C-u-delete' after this is run?
(when evil-want-C-u-delete
(evil-collection-define-key 'insert 'eshell-mode-map
(kbd "C-u") 'eshell-kill-input))
(evil-collection-define-key 'visual 'eshell-mode-map
;; motion
;; TODO: This does not work with `evil-visual-line'.
@ -137,6 +143,7 @@
;;;###autoload
(defun evil-collection-eshell-setup ()
"Set up `evil' bindings for `eshell'."
(add-hook 'eshell-mode-hook 'evil-collection-eshell-escape-stay)
(add-hook 'eshell-mode-hook 'evil-collection-eshell-next-prompt-on-insert)
(add-hook 'eshell-first-time-mode-hook 'evil-collection-eshell-setup-keys))

View File

@ -0,0 +1,101 @@
;;; evil-collection-forge.el --- Evil-based key bindings for forge
;; Copyright (C) 2021 James Nguyen
;; Author: James Nguyen <james@jojojames.com>
;; Maintainer: James Nguyen <james@jojojames.com>
;; Package-Requires: ((emacs "25.1") (evil "1.2.3"))
;; Homepage: https://github.com/emacs-evil/evil-collection
;; Version: 0.4.1
;; 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:
;; This library configures Magit and Evil to play well with each
;; other. For some background see:
;; https://github.com/emacs-evil/evil-collection/issues/543.
;;; Code:
(require 'evil-collection)
(require 'forge nil t)
(require 'transient nil t)
(defcustom evil-collection-forge-use-y-for-yank t
"View `evil-collection-magit-state' for more information."
:group 'magit
:type 'boolean)
(defcustom evil-collection-forge-state
(if evil-collection-forge-use-y-for-yank 'normal 'motion)
"State to use for forge."
:group 'magit
:type 'symbol)
;;;###autoload
(defun evil-collection-forge-setup ()
"Set up `evil' bindings for `magit'."
(let ((states (if evil-collection-forge-use-y-for-yank
`(,evil-collection-forge-state visual)
`(,evil-collection-forge-state))))
(dolist (state states)
(evil-collection-define-key state 'magit-mode-map "@" 'forge-dispatch)
(evil-collection-define-key
state 'magit-commit-section-map
[remap magit-browse-thing] 'forge-browse-dwim)
(evil-collection-define-key
state 'magit-remote-section-map
[remap magit-browse-thing] 'forge-browse-remote)
(evil-collection-define-key
state 'magit-branch-section-map
[remap magit-browse-thing] 'forge-browse-branch)
(evil-collection-define-key
state 'magit-commit-section-map (kbd "C-c C-v") 'forge-visit-topic)
(evil-collection-define-key
state 'magit-branch-section-map (kbd "C-c C-v") 'forge-visit-topic)))
;; https://github.com/magit/forge/blob/master/lisp/forge.el
(transient-append-suffix 'magit-dispatch "!"
'("@" "Forge" forge-dispatch)) ;; N -> @
(transient-append-suffix 'magit-fetch "m"
'("n" "forge topics" forge-pull))
(transient-append-suffix 'magit-fetch "n"
'("N" "forge notifications" forge-pull-notifications))
(transient-append-suffix 'magit-pull "m"
'("n" "forge topics" forge-pull))
(transient-append-suffix 'magit-pull "n"
'("N" "forge notifications" forge-pull-notifications))
(transient-append-suffix 'magit-branch "w"
'("n" "pull-request" forge-checkout-pullreq))
(transient-append-suffix 'magit-branch "W"
'("N" "from pull-request" forge-branch-pullreq))
(transient-append-suffix 'magit-worktree "c"
'("n" "pull-request worktree" forge-checkout-worktree))
(transient-append-suffix 'magit-status-jump "w"
'("Np" "pull-requests" forge-jump-to-pullreqs))
(transient-append-suffix 'magit-status-jump "Np"
'("Ni" "issues" forge-jump-to-issues))
(transient-append-suffix 'magit-merge "a"
'(7 "M" "Merge using API" forge-merge)))
;;; evil-collection-forge.el ends soon
(provide 'evil-collection-forge)
;; Local Variables:
;; End:
;;; evil-collection-forge.el ends here

View File

@ -294,7 +294,6 @@ When this option is enabled, the stash popup is available on \"Z\"."
(,states magit-mode-map "'" magit-submodule "o")
(,states magit-mode-map "\"" magit-subtree "O")
(,states magit-mode-map "=" magit-diff-less-context "-")
(,states magit-mode-map "@" forge-dispatch)
(,states magit-mode-map "j" evil-next-line)
(,states magit-mode-map "k" evil-previous-line)
(,states magit-mode-map "gg" evil-goto-first-line)
@ -600,16 +599,6 @@ evil-collection-magit affects.")
(unless evil-collection-magit-popup-keys-changed
(dolist (change evil-collection-magit-popup-changes)
(apply #'evil-collection-magit-change-popup-key change))
(with-eval-after-load 'forge
;; When `forge' is loaded, it maps `forge-dispatch' to ' key which is
;; set for `magit-submodule', wiping it so we add it back after `forge'
;; loads.
(transient-append-suffix 'magit-dispatch "M"
'("'" "Submodule" magit-submodule))
;; Clear `forge' key and re-add back in as "@".
(transient-remove-suffix 'magit-dispatch 'forge-dispatch)
(transient-append-suffix 'magit-dispatch "!"
'("@" "Forge" forge-dispatch)))
(setq evil-collection-magit-popup-keys-changed t)))
(defun evil-collection-magit-revert-popups ()

View File

@ -202,7 +202,7 @@
"ce" mu4e-compose-edit
"cf" mu4e-compose-forward
"cr" mu4e-compose-reply
"p" mu4e-view-save-attachment
"p" mu4e-view-save-attachments
"P" mu4e-view-save-attachment-multi ; Since mu4e 1.0, -multi is same as normal.
"O" mu4e-headers-change-sorting
"A" mu4e-view-mime-part-action ; Since 1.6, uses gnus view by default

View File

@ -0,0 +1,47 @@
;;; evil-collection-scheme.el --- Evil bindings for scheme -*- lexical-binding: t -*-
;; Copyright (C) 2021 Zhiwei Chen
;; Author: Zhiwei Chen <condy0919@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, lisp, languages
;; 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 scheme.
;;; Code:
(require 'evil-collection)
(defconst evil-collection-scheme-maps '(scheme-mode-map))
(defun evil-collection-scheme-repl ()
"Open the scheme REPL."
(interactive)
(pop-to-buffer (get-buffer-create "*scheme*"))
(call-interactively #'run-scheme))
;;;###autoload
(defun evil-collection-scheme-setup ()
"Set up `evil' bindings for `scheme'."
(evil-collection-define-key 'normal 'scheme-mode-map
"gz" 'evil-collection-scheme-repl))
(provide 'evil-collection-scheme)
;;; evil-collection-scheme.el ends here