Replace doom/backward-kill-to-bol-and-indent

WIth new evil-delete-back-to-indentation, with behaves exactly as C-u
does in vim.
This commit is contained in:
Henrik Lissner 2019-12-21 03:28:07 -05:00
parent a49c0b6691
commit c1879945fd
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
6 changed files with 7 additions and 21 deletions

View file

@ -155,20 +155,6 @@ true end of the line. The opposite of `doom/backward-to-bol-or-indent'."
tab-width tab-width
(- tab-width movement))))))))) (- 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 ;;;###autoload
(defun doom/retab (arg &optional beg end) (defun doom/retab (arg &optional beg end)
"Converts tabs-to-spaces or spaces-to-tabs within BEG and END (defaults to "Converts tabs-to-spaces or spaces-to-tabs within BEG and END (defaults to

View file

@ -1,10 +1,9 @@
;;; config/default/+bindings.el -*- lexical-binding: t; -*- ;;; config/default/+bindings.el -*- lexical-binding: t; -*-
(when (featurep! :editor evil +everywhere) (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. ;; NOTE SPC u replaces C-u as the universal argument.
(map! :i "C-u" #'doom/backward-kill-to-bol-and-indent (map! :i "C-w" #'backward-kill-word
:i "C-w" #'backward-kill-word
;; Vimmish ex motion keys ;; Vimmish ex motion keys
:i "C-b" #'backward-word :i "C-b" #'backward-word
:i "C-f" #'forward-word) :i "C-f" #'forward-word)
@ -23,7 +22,7 @@
"C-b" #'backward-word "C-b" #'backward-word
"C-f" #'forward-word "C-f" #'forward-word
"C-r" #'evil-paste-from-register "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-v" #'yank
"C-w" #'backward-kill-word "C-w" #'backward-kill-word
"C-z" (λ! (ignore-errors (call-interactively #'undo))) "C-z" (λ! (ignore-errors (call-interactively #'undo)))

View file

@ -262,7 +262,7 @@
"s-/" (λ! (save-excursion (comment-line 1))) "s-/" (λ! (save-excursion (comment-line 1)))
:n "s-/" #'evilnc-comment-or-uncomment-lines :n "s-/" #'evilnc-comment-or-uncomment-lines
:v "s-/" #'evilnc-comment-operator :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-left] #'doom/backward-to-bol-or-indent
:gi [s-right] #'doom/forward-to-last-non-comment-or-eol :gi [s-right] #'doom/forward-to-last-non-comment-or-eol
:gi [M-backspace] #'backward-kill-word :gi [M-backspace] #'backward-kill-word

View file

@ -22,6 +22,7 @@ directives. By default, this only recognizes C directives.")
;; to loading. ;; to loading.
(defvar evil-want-C-i-jump (or (daemonp) (display-graphic-p))) (defvar evil-want-C-i-jump (or (daemonp) (display-graphic-p)))
(defvar evil-want-C-u-scroll t) (defvar evil-want-C-u-scroll t)
(defvar evil-want-C-u-delete t)
(defvar evil-want-C-w-scroll t) (defvar evil-want-C-w-scroll t)
(defvar evil-want-Y-yank-to-eol t) (defvar evil-want-Y-yank-to-eol t)
(defvar evil-want-abbrev-expand-on-insert-exit nil) (defvar evil-want-abbrev-expand-on-insert-exit nil)

View file

@ -67,7 +67,7 @@
(company-complete-common . evil-mc-execute-default-complete) (company-complete-common . evil-mc-execute-default-complete)
(doom/backward-to-bol-or-indent . evil-mc-execute-default-call) (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/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) ;; Have evil-mc work with explicit `evil-escape' (on C-g)
(evil-escape . evil-mc-execute-default-evil-normal-state) (evil-escape . evil-mc-execute-default-evil-normal-state)
;; Add `evil-org' support ;; Add `evil-org' support

View file

@ -149,7 +149,7 @@ You should use `set-eshell-alias!' to change this.")
[remap split-window-below] #'+eshell/split-below [remap split-window-below] #'+eshell/split-below
[remap split-window-right] #'+eshell/split-right [remap split-window-right] #'+eshell/split-right
[remap doom/backward-to-bol-or-indent] #'eshell-bol [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-split] #'+eshell/split-below
[remap evil-window-vsplit] #'+eshell/split-right))) [remap evil-window-vsplit] #'+eshell/split-right)))
(add-hook! 'eshell-mode-hook (add-hook! 'eshell-mode-hook