2

If I open a file in vi like:

vi /etc/httpd/conf/httpd.conf

Then vi shows in the bottom left corner of the window:

"/etc/httpd/conf/httpd.conf" 1009L, 34418C

But when I edit the file with a or i then this line disappears.
And even when pressing Esc to exit the editing mode it wont come back.

How do I get this line back after editing?

  • 3
    I use Ctrl+g for this – Alexander Myshov Jun 5 '15 at 16:42
  • Which is the same as :file :-) I wanted to give that as an answer, but is doesn't show the amount of characers. I'm not sure how to get exactly that line... – Martin Tournoij Jun 5 '15 at 17:29
  • 3
    You can display this information in your statusline with let &statusline = '"%f" %{line("$")}L, %{line2byte(line("$"))}C'. You can also make a mapping to echo this: nnoremap <Leader>fi :echo '"' . expand("%") . '" ' . line("$") . "L, " . line2byte(line("$")) . "C"<CR> – jjaderberg Jun 5 '15 at 18:32
  • @Carpetsmoker I think it shows bytes, not characters, despite the "C". I haven't looked carefully but for me the number seems to agree with output from wc -c, not from wc -m. – jjaderberg Jun 5 '15 at 18:34
3

If you save, you can then use :e again, to display that information. Also, you can use g Ctrl-g and/or Ctrl-g at any time to find out some (or the other) of the original info.

  • Mnemonic: Ctrl-g to find out what is Going on. – Wildcard Feb 15 '16 at 8:30

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.