Currently when performing evil-search-forward , pressing C-w causes the cursor to yank and append the current word to the search (because that's what isearch does).

I'd like to change that to the usual delete-word, but remapping it in isearch-mode-map causes the under the cursor to get deleted.

Any way I can fix this?

  • I'm not sure what's wrong about deleting the word under cursor if you've remapped C-w to delete the word under cursor. Please go into more detail.
    – wasamasa
    Apr 16, 2017 at 13:15
  • Try typing F1 k C-w in appropriate context to see which keymap you should modify.
    – user12563
    Apr 16, 2017 at 15:54
  • so what I really want is to delete a word in the minibuffer, since that's my search query, however, when I rebind evil-search-forward, in addition to messing up my minibuffer in a weird way, the buffer also has its word deleted Also it appears that isearch-yank-word-or-char is originally bound to this function.
    – Wagk
    Apr 16, 2017 at 16:13
  • I would like to clarify that I want to delete a word from the search query, which resides in the minibuffer
    – Wagk
    Apr 16, 2017 at 16:23
  • BTW, this question is not about Evil, but isearch. I've changed title and tags accordingly.
    – wasamasa
    Apr 17, 2017 at 15:26

1 Answer 1


Remapping keys in isearch is nothing special, however isearch is not using the minibuffer, but the echo area for displaying its state. This means that trying to use a conventional editing command like delete-word will not have the intended effect (deleting a word in the minibuffer), but rather edit text in the buffer you started the search from.

To solve this, you must write your own function in the style of what's been bound to C-w before, manipulating isearch state. Judging by the sources of isearch-delete-char, you're working with a sequence of isearch commands (one for each char) and can pop these to undo what has been typed. I'd consider reporting a bug to request this feature to be implemented as it's not obvious how you'd do it yourself.

  • I probably don't have the knowledge to write such a function yet. Cheers for the info
    – Wagk
    Apr 18, 2017 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.