I have hlsearch activated. Sometimes I search for terms I want to correct or delete via / and then selecting for the individual instance via n. Is there a command to delete the current word on which my cursor is on and which is highlighted via 'hlsearch'? I cannot use dw as sometimes the word is part of a camel case or snake case word.


1 Answer 1


gnd (or dgn) deletes the next occurrence of the last searched term (deleting at the cursor position if it matches the search). See :help gn.

(The hlsearch setting is irrelevant to this command.)

  • 4
    It's worth mentioning that cgn can be repeated with ., as in /wrongword<CR>cgnrightword<Esc>......
    – D. Ben Knoble
    Mar 24, 2021 at 0:17

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.