From c1879945fdc2269aaeb91e6f650d1959a5bc7407 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 21 Dec 2019 03:28:07 -0500 Subject: [PATCH] Replace doom/backward-kill-to-bol-and-indent WIth new evil-delete-back-to-indentation, with behaves exactly as C-u does in vim. --- core/autoload/text.el | 14 -------------- modules/config/default/+evil-bindings.el | 7 +++---- modules/config/default/config.el | 2 +- modules/editor/evil/config.el | 1 + modules/editor/multiple-cursors/config.el | 2 +- modules/term/eshell/config.el | 2 +- 6 files changed, 7 insertions(+), 21 deletions(-) diff --git a/core/autoload/text.el b/core/autoload/text.el index 8c08c5a67..f7f67f0d1 100644 --- a/core/autoload/text.el +++ b/core/autoload/text.el @@ -155,20 +155,6 @@ true end of the line. The opposite of `doom/backward-to-bol-or-indent'." tab-width (- tab-width movement))))))))) -;;;###autoload -(defun doom/backward-kill-to-bol-and-indent () - "Kill line to the first non-blank character. If invoked again -afterwards, kill line to beginning of line." - (interactive) - (let ((empty-line-p (save-excursion (beginning-of-line) - (looking-at-p "[ \t]*$")))) - (funcall (if (fboundp 'evil-delete) - #'evil-delete - #'delete-region) - (point-at-bol) (point)) - (unless empty-line-p - (indent-according-to-mode)))) - ;;;###autoload (defun doom/retab (arg &optional beg end) "Converts tabs-to-spaces or spaces-to-tabs within BEG and END (defaults to diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index 365e34aba..00a8e025a 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -1,10 +1,9 @@ ;;; config/default/+bindings.el -*- lexical-binding: t; -*- (when (featurep! :editor evil +everywhere) - ;; Have C-u behave similarly to `doom/backward-to-bol-or-indent'. + ;; `evil' provides `C-u' (bound to `evil-delete-back-to-indentation') ;; NOTE SPC u replaces C-u as the universal argument. - (map! :i "C-u" #'doom/backward-kill-to-bol-and-indent - :i "C-w" #'backward-kill-word + (map! :i "C-w" #'backward-kill-word ;; Vimmish ex motion keys :i "C-b" #'backward-word :i "C-f" #'forward-word) @@ -23,7 +22,7 @@ "C-b" #'backward-word "C-f" #'forward-word "C-r" #'evil-paste-from-register - "C-u" #'doom/backward-kill-to-bol-and-indent + "C-u" #'evil-delete-back-to-indentation "C-v" #'yank "C-w" #'backward-kill-word "C-z" (λ! (ignore-errors (call-interactively #'undo))) diff --git a/modules/config/default/config.el b/modules/config/default/config.el index f1112c064..788c7d326 100644 --- a/modules/config/default/config.el +++ b/modules/config/default/config.el @@ -262,7 +262,7 @@ "s-/" (λ! (save-excursion (comment-line 1))) :n "s-/" #'evilnc-comment-or-uncomment-lines :v "s-/" #'evilnc-comment-operator - :gi [s-backspace] #'doom/backward-kill-to-bol-and-indent + :gi [s-backspace] #'evil-delete-back-to-indentation :gi [s-left] #'doom/backward-to-bol-or-indent :gi [s-right] #'doom/forward-to-last-non-comment-or-eol :gi [M-backspace] #'backward-kill-word diff --git a/modules/editor/evil/config.el b/modules/editor/evil/config.el index 3099e5ab4..c2a2dad43 100644 --- a/modules/editor/evil/config.el +++ b/modules/editor/evil/config.el @@ -22,6 +22,7 @@ directives. By default, this only recognizes C directives.") ;; to loading. (defvar evil-want-C-i-jump (or (daemonp) (display-graphic-p))) (defvar evil-want-C-u-scroll t) +(defvar evil-want-C-u-delete t) (defvar evil-want-C-w-scroll t) (defvar evil-want-Y-yank-to-eol t) (defvar evil-want-abbrev-expand-on-insert-exit nil) diff --git a/modules/editor/multiple-cursors/config.el b/modules/editor/multiple-cursors/config.el index 3e85d7430..a52ffea66 100644 --- a/modules/editor/multiple-cursors/config.el +++ b/modules/editor/multiple-cursors/config.el @@ -67,7 +67,7 @@ (company-complete-common . evil-mc-execute-default-complete) (doom/backward-to-bol-or-indent . evil-mc-execute-default-call) (doom/forward-to-last-non-comment-or-eol . evil-mc-execute-default-call) - (doom/backward-kill-to-bol-and-indent . evil-mc-execute-default-call) + (evil-delete-back-to-indentation . evil-mc-execute-default-call) ;; Have evil-mc work with explicit `evil-escape' (on C-g) (evil-escape . evil-mc-execute-default-evil-normal-state) ;; Add `evil-org' support diff --git a/modules/term/eshell/config.el b/modules/term/eshell/config.el index 89deb3f1e..eae619ba8 100644 --- a/modules/term/eshell/config.el +++ b/modules/term/eshell/config.el @@ -149,7 +149,7 @@ You should use `set-eshell-alias!' to change this.") [remap split-window-below] #'+eshell/split-below [remap split-window-right] #'+eshell/split-right [remap doom/backward-to-bol-or-indent] #'eshell-bol - [remap doom/backward-kill-to-bol-and-indent] #'eshell-kill-input + [remap evil-delete-back-to-indentation] #'eshell-kill-input [remap evil-window-split] #'+eshell/split-below [remap evil-window-vsplit] #'+eshell/split-right))) (add-hook! 'eshell-mode-hook