Move evil ex commands to feature/evil

These commands aren't used by config/default anyway, and
+default:multi-{next,previous}-line were moved to my private config.

Also fixes #1208 (:cd without args will now CD to $HOME).
This commit is contained in:
Henrik Lissner 2019-02-28 14:30:40 -05:00
parent cf07bac383
commit ad837e6d13
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 23 additions and 41 deletions

View file

@ -1,38 +0,0 @@
;; config/default/autoload/evil.el -*- lexical-binding: t; -*-
;;;###if (featurep! :feature evil)
;;;###autoload (autoload '+default:multi-next-line "config/default/autoload/evil" nil t)
(evil-define-motion +default:multi-next-line (count)
"Move down 6 lines."
:type line
(let ((line-move-visual (or visual-line-mode (derived-mode-p 'text-mode 'magit-mode))))
(evil-line-move (* 6 (or count 1)))))
;;;###autoload (autoload '+default:multi-previous-line "config/default/autoload/evil" nil t)
(evil-define-motion +default:multi-previous-line (count)
"Move up 6 lines."
:type line
(let ((line-move-visual (or visual-line-mode (derived-mode-p 'text-mode 'magit-mode))))
(evil-line-move (- (* 6 (or count 1))))))
;;;###autoload (autoload '+default:cd "config/default/autoload/evil" nil t)
(evil-define-command +default:cd (path)
"Change `default-directory' with `cd'."
(interactive "<f>")
(cd path)
(message "Changed directory to '%s'" (abbreviate-file-name (expand-file-name path))))
;;;###autoload (autoload '+default:kill-all-buffers "config/default/autoload/evil" nil t)
(evil-define-command +default:kill-all-buffers (&optional bang)
"Kill all buffers. If BANG, kill current session too."
(interactive "<!>")
(if bang
(+workspace/kill-session)
(doom/kill-all-buffers)))
;;;###autoload (autoload '+default:kill-matching-buffers "config/default/autoload/evil" nil t)
(evil-define-command +default:kill-matching-buffers (&optional bang pattern)
"Kill all buffers matching PATTERN regexp. If BANG, only match project
buffers."
(interactive "<a>")
(doom/kill-matching-buffers pattern bang))

View file

@ -42,6 +42,26 @@ This command understands vim file modifiers (like %:p:h). See
(interactive "<r>")
(reverse-region beg end))
(evil-define-command +evil:cd (&optional path)
"Change `default-directory' with `cd'."
(interactive "<f>")
(let ((path (or path "~")))
(cd path)
(message "Changed directory to '%s'" (abbreviate-file-name (expand-file-name path)))))
(evil-define-command +evil:kill-all-buffers (&optional bang)
"Kill all buffers. If BANG, kill current session too."
(interactive "<!>")
(if (and bang (fboundp '+workspace/kill-session))
(+workspace/kill-session)
(doom/kill-all-buffers)))
(evil-define-command +evil:kill-matching-buffers (&optional bang pattern)
"Kill all buffers matching PATTERN regexp. If BANG, only match project
buffers."
(interactive "<a>")
(doom/kill-matching-buffers pattern bang))
;;
;; Commands
@ -91,8 +111,8 @@ This command understands vim file modifiers (like %:p:h). See
;;; Dealing with buffers
(evil-ex-define-cmd "k[ill]" #'doom/kill-this-buffer)
(evil-ex-define-cmd "k[ill]all" #'+default:kill-all-buffers)
(evil-ex-define-cmd "k[ill]m" #'+default:kill-matching-buffers)
(evil-ex-define-cmd "k[ill]all" #'+evil:kill-all-buffers)
(evil-ex-define-cmd "k[ill]m" #'+evil:kill-matching-buffers)
(evil-ex-define-cmd "k[ill]o" #'doom/kill-other-buffers)
(evil-ex-define-cmd "l[ast]" #'doom/popup-restore)
(evil-ex-define-cmd "m[sg]" #'view-echo-area-messages)
@ -100,7 +120,7 @@ This command understands vim file modifiers (like %:p:h). See
;;; Project navigation
(evil-ex-define-cmd "a" #'projectile-find-other-file)
(evil-ex-define-cmd "cd" #'+default:cd)
(evil-ex-define-cmd "cd" #'+evil:cd)
(evil-ex-define-cmd "pwd" #'+evil:pwd)
(cond ((featurep! :completion ivy)