I am trying to use <count> and -count to make a command repeatable. This is the command I have right now:

command! -count=1 Hello :d <count>.

But I got this error instead when I run :Hello:

E488: Trailing characters: :d 1.

How can I get its syntax correctly?

  • 2
    Is the issue the trailing . you have in the command definition?
    – filbranden
    Commented May 4, 2021 at 4:29
  • 1
    yes, just remove the trailing . and it should just work Commented May 4, 2021 at 6:48
  • But how can I make this :d repeat? How can a command take [count]? Commented May 4, 2021 at 7:56
  • 1
    what do you actually want to achieve? What do you mean with repeat? Commented May 4, 2021 at 9:29


Your Answer

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

Browse other questions tagged or ask your own question.