diff --git a/core/autoload/text.el b/core/autoload/text.el index f7f67f0d1..44e4d695d 100644 --- a/core/autoload/text.el +++ b/core/autoload/text.el @@ -129,6 +129,20 @@ true end of the line. The opposite of `doom/backward-to-bol-or-indent'." (setq doom--last-forward-pt (point)) (goto-char eol)))))) +;;;###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. Same as `evil-delete-back-to-indentation'." + (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/dumb-indent () "Inserts a tab character (or spaces x tab-width)." diff --git a/modules/config/default/config.el b/modules/config/default/config.el index 2b51a68e0..26c194e7d 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] #'evil-delete-back-to-indentation + :gi [s-backspace] #'doom/backward-kill-to-bol-and-indent :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/term/eshell/config.el b/modules/term/eshell/config.el index eae619ba8..5e185b60a 100644 --- a/modules/term/eshell/config.el +++ b/modules/term/eshell/config.el @@ -149,6 +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)))