How do I show Filename, Line Count, and Character Count in vim?

14

3

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.

MattSayar

Posted 2012-08-09T15:34:46.410

Reputation: 293

Answers

16

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

garyjohn

Posted 2012-08-09T15:34:46.410

Reputation: 29 085

12

In ~/.vimrc, add the line:

set ruler

deesto

Posted 2012-08-09T15:34:46.410

Reputation: 312

4

save your file :w

then reload it :e

HVNSweeting

Posted 2012-08-09T15:34:46.410

Reputation: 618

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

MaciekTalaska

Posted 2012-08-09T15:34:46.410

Reputation: 171