Here's an example:

console.log("basename of"path.basename(__filename))

With my cursor on path in the first line, I've tried:


but then my cursor jumped to the next line, at __filename)), which is last character of that line. I also Googled around and tried:


Nothing happened, and I have to manually cancel the highlighting of search the results.

1 Answer 1


If you want to delete till the second occurence:


Which translates to:


d    " Delete
  t  " till
 2   " second occurence of
   ) " )
  • Oh, I thought dt2) is more intuitive, thanks a lot! Jul 10, 2021 at 10:36
  • 3
    @job_start dt2) translates to delete till the character 2
    – zoomlogo
    Jul 10, 2021 at 10:38
  • 3
    Welcome to Vi and Vim! The reason for the cursor movement is what you pointed out in that last comment: vim sees two commands. (1) dt2, which fails (assuming 2 is not in the line after the cursor). (2) ), which moves to the end of the "sentence"
    – D. Ben Knoble
    Jul 10, 2021 at 20:00

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.