4

Here's an example:

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

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

dt2)

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

dt2/)<Enter>

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

1 Answer 1

7

If you want to delete till the second occurence:

d2t)

Which translates to:

d2t)

d    " Delete
  t  " till
 2   " second occurence of
   ) " )
3
  • Oh, I thought dt2) is more intuitive, thanks a lot! Commented Jul 10, 2021 at 10:36
  • 3
    @job_start dt2) translates to delete till the character 2
    – zoomlogo
    Commented 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" Commented 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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.