JuanPablo
JuanPablo

Reputation: 24774

vim: count characters in a buffer from a function

in vim, with strlen, I can count the number of characters in a line.

Example: count the characters in last line

 strlen(getline('$'))

how I can count the characters in the buffer ?

Upvotes: 2

Views: 805

Answers (1)

Ayman
Ayman

Reputation: 11585

You can use g CTRL-G to display stats of the current buffer, including char count.

line2byte(line('$') + 1) works in scripts.

Upvotes: 6

Related Questions