ArtOfWarfare
ArtOfWarfare

Reputation: 21507

What does the blue @ vi shows in my file indicate?

I opened a file in vi and I noticed that it sometimes shows a blue @ in the bottom left corner of the terminal, above where commands are entered but below the actual text of my file. As I scroll through the file, the symbol appears and disappears periodically - what does it indicate? Are there unprintable symbols in my file that it's alerting me about, or is the symbol appearing for some other reason?

Upvotes: 1

Views: 2997

Answers (1)

rob mayoff
rob mayoff

Reputation: 386038

By default, vi soft wraps long lines. If a line in the file is wider than your window, it wraps the line on the screen. For example, if you have this line in your file:

This is a very long line of text that doesn't fit on one screen line.

and your window is only 40 characters wide, vi displays it like this:

This is a very long line of text that do
esn't fit on one screen line.

But what if the line is toward the bottom of the screen and there's not enough room to display all of the wrapped continuation lines? In that case, vi doesn't display any of the characters in the line. Instead, it just displays @ on each screen line that would contain part of the file line. That way you know there's something more in the file, and you don't get a false idea of where the line ends.

So suppose you make your window 40 characters wide and 20 lines tall. Put 18 short lines in your file, followed by my example line above. Then vi displays this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
@                                       

(The last line of the screen, which is blank, is the vi status line. Your settings might make it display information in that line.)

If you press G (to go to the end of the file), then vi displays the full line, wrapped:

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
This is a very long line of text that do
esn't fit on one screen line.

Upvotes: 3

Related Questions