14

When you first launch vim with vim myfile.c, in the bottom-left of the screen it shows the filename in quotes, the number of lines, then the character count. It disappears the minute something else needs that real estate. How do I get it back?

I know :echo @% can get you the filename, but that's only 1/3 of the way there.

4 Answers 4

18

You can get the character and line count by typing g Ctrl-G. To see the filename and line count as you do when you open a file, execute :f. See

:help g_CTRL-G
:help :f
1
  • Hi, would there be a way to add this as a default in .vimrc ? Thanks a lot !
    – paupaulaz
    Dec 24, 2021 at 9:57
12

In ~/.vimrc, add the line:

set ruler

4

save your file :w

then reload it :e

2
  1. For the line count: edit the .vimrc file, and add to it set nu
  2. Character count: someone has already asked for that and an answer has been given: https://superuser.com/a/149947/151320 - it is as simple as: g CTRL-G

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.