Skip to content

Commit

Permalink
make C-w in ex, search, and eval match insert and replace (#1922)
Browse files Browse the repository at this point in the history
* make C-w in ex and search match insert and replace

merely changed bindings and added a test

* fix evil-delete-backward-word in ex test
  • Loading branch information
totallyuniquelily authored Jul 10, 2024
1 parent 0347d79 commit f5215fd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions evil-maps.el
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ included in `evil-insert-state-bindings' by default."
(define-key evil-command-line-map "\C-u" 'evil-delete-whole-line)
(define-key evil-command-line-map "\C-v" #'quoted-insert)
(when evil-want-C-w-delete
(define-key evil-command-line-map "\C-w" #'backward-kill-word))
(define-key evil-command-line-map "\C-w" #'evil-delete-backward-word))
(define-key evil-command-line-map [escape] #'abort-recursive-edit)
(define-key evil-command-line-map [S-left] #'backward-word)
(define-key evil-command-line-map [S-right] #'forward-word)
Expand Down Expand Up @@ -653,7 +653,7 @@ included in `evil-insert-state-bindings' by default."
(define-key evil-eval-map "\C-n" #'next-complete-history-element)
(define-key evil-eval-map "\C-u" 'evil-delete-whole-line)
(define-key evil-eval-map "\C-v" #'quoted-insert)
(define-key evil-eval-map "\C-w" 'backward-kill-word)
(define-key evil-eval-map "\C-w" 'evil-delete-backward-word)
(define-key evil-eval-map [escape] 'abort-recursive-edit)
(define-key evil-eval-map [S-left] 'backward-word)
(define-key evil-eval-map [S-right] 'forward-word)
Expand Down
9 changes: 7 additions & 2 deletions evil-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -2222,7 +2222,7 @@ ine3 line3 line3 l\n"))
"line1\n\n[\n]last line\n")))

(ert-deftest evil-test-delete-backward-word ()
"Test `evil-delete-backward-word' in insert & replace states."
"Test `evil-delete-backward-word' in insert & replace states, and ex command-line."
:tags '(evil)
(ert-info ("evil-delete-backward-word in insert state")
(let ((evil-backspace-join-lines t))
Expand Down Expand Up @@ -2251,7 +2251,12 @@ ine3 line3 line3 l\n"))
("\C-w")
"alpha bravo [c]harlie delta"
("\C-w")
"alpha [b]ravo charlie delta")))
"alpha [b]ravo charlie delta"))
(ert-info ("evil-delete-backward-word in ex command-line")
(evil-test-buffer
"[ ]"
(":normal i" "one-two" (kbd "C-w") (kbd "C-w") [return])
"on[e]")))

(ert-deftest evil-test-visual-X ()
"Test `X' in visual state."
Expand Down
4 changes: 2 additions & 2 deletions evil-vars.el
Original file line number Diff line number Diff line change
Expand Up @@ -558,11 +558,11 @@ ubiquity of prefix arguments."
(cond
((and (not value)
(eq (lookup-key evil-command-line-map (kbd "C-w"))
#'backward-kill-word))
#'evil-delete-backward-word))
(define-key evil-command-line-map (kbd "C-w") nil))
((and value
(null (lookup-key evil-command-line-map (kbd "C-w"))))
(define-key evil-command-line-map (kbd "C-w") #'backward-kill-word))))
(define-key evil-command-line-map (kbd "C-w") #'evil-delete-backward-word))))
(when (boundp 'evil-ex-search-keymap)
(cond
((and (not value)
Expand Down

0 comments on commit f5215fd

Please sign in to comment.