I work in a translation company , and need to count the time that the actor speaks, and insert the count into the current file.

In my vimrc file I created this function:

fun! Abb()
    exe ":s/-//gn"

How do I insert the number of word count manually. Thanks for your help

  • You can use external tools like word count wc in linux.
    – SibiCoder
    Sep 23, 2016 at 5:48
  • What does those number and hyphens represent? Which one to count as word?
    – SibiCoder
    Sep 23, 2016 at 5:49
  • This is the resume of a file, the translator make 120 pages of all the movie, then us manually separate loop of 20 second, and the number above represent the loop into the actor speak in Portuguese. The money that the actor earn depend of this number. Sep 23, 2016 at 18:01

1 Answer 1


Assuming for each actor, you only have a single line with the many hyphens and your cursor is on a line with the many hyphens, you can do it like this:

call append('.', "Count: ".len(split(getline('.'),'-')))

Of course you can now wrap it into a function, find the next line with hyphens in it, if the cursor is not on it or add some error management. That is left as an excercise to the reader :)


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.