1

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

1 Answer 1

5

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.)

1
  • 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 that you have read and understand our privacy policy and code of conduct.

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