0

File BATMAN:

-2-3-4-6-8-10-11-13-14-16-17-18-19-20-21-25-29-30-33-35-36-37-43-44-45-47-48-49-50-51-52-54-55-56-57-58-59-60-61-62-63-64-65-66-68-69-70-71-73-74-75-76-81-82-83-85-86-87-88-89-90-91-92-94-95-96-97-98-99-101-102-103-104-108-110-111-112-113-114-115-116-117-128-129-130-131-132-133-134-135-136-137-147-148-149-150-151-154-155-156-157-158-159-160-161-162-163-164-165-166-167-168-171-173-174-175-177-180-184-185-186-187-188-189-190-191

File ROBIN:

-2-3-4-6-7-8-11-16-17-18-20-21-29-30-33-34-35-36-37-44-48-49-51-52-55-56-57-58-61-65-66-67-69-70-71-74-75-76-80-81-82-83-86-90-91-92-95-97-98-100-101-103-104-119-120-121-122-123-124-125-127-129-131-132-133-134-136-138-139-140-141-142-143-144-150-156-157-158-161-163-164-165-166-167-172-173-175-179-184-186-189-191

File LOCUTOR:

-4-147

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"
endfunc

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

3
  • 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

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

1

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.