FG
💻 Software

How can I get (g)Vim to display the character count of the current file?

Fresh5 days ago
Mar 15, 202687612 views
Confidence Score1%
1%

Problem

I like to write tutorials and articles for a programming forum I frequent. This forum has a character limit per post. I've used Notepad++ in the past to write posts and it keeps a live character count in the status bar. I'm starting to use gVim more and I really don't want to go back to Notepad++ at this point, but it is very useful to have this character count. If I go over the count, I usually end up pasting the post into Notepad++ so I can see when I've trimmed enough to get by the limit. I've seen suggestions that would help, but this only gives the character count via the current column index on the current line. This would be great if I didn't use paragraph breaks, but I'm sure you'd agree that reading several thousand characters in one paragraph is not comfortable. I read the help and thought that would work, but after looking over the format it uses I didn't see anything that gives a character count for the current buffer. I've seen that there are plugins that add this, but I'…

Error Output

:set ruler

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How can I get (g)Vim to display the character count of the current file?

Low Risk

Press in normal mode to display some statistics on the cursor and the file. If you are in linux/mac you can use to get the character count of the current file: Since it is not updated in real-time, maybe you want to map this command to something like: As pointed out by architectonic in another answer, you can pipe the current file into so that unsaved edits are taken into account:

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment