Home » Questions » Computers [ Ask a new question ]

Bottom-right numbers in Vim

Bottom-right numbers in Vim

At the bottom right hand side of the vim editor, there are 2 numbers that display the row and column number in the following format:

Asked by: Guest | Views: 250
Total answers/comments: 2
Guest [Entry]

"It refers to cursor position with respect to special characters (ie: tab).

Say your screen was like this (small screen, I know):

1 x x x x x x x x x x - - - - - - - - - - - - - - -
2 - - - - - - - - - - - - - - - - - - - - - - - - -
3 - - - - - - - - - - - - - - - - - - - - - - - - -
4 - - - - - - - - - - - - - - - - - - - - - - - - -
5 - - x --- --- --- x
6 - - - - - - - - - - - - - - - - - - - - - - - - -
7 - - - - - - - - - - - - - - - - - - - - - - - - -
8 x x x x x x x x x x x x x x x x x x x x x x x x x

Any single character (except unicode) = 1 byte
3 attached lines (---) = Tab = 1 byte
1 space (-) = 1 byte

Tab is configured to display over 8 columns.

If your cursor was on the last X in line 1, Vim would show 1,10. If it was on the first X in line 5, it would show 5,3. The last X in line 8 represents 8,25. However, since the second X on line 5 is separated by 3 Tab sequences, if your cursor was on the last X, it would show 5,7-25.

The first 5 is obviously the line number
The 7 represents the byte number in the column (2 spaces, an x, 3 tabs, and the last x = 7)
The 25 represents the column as you see it in the console. Using 25 spaces would be at the same position as 2 spaces, an x, 3 tabs, and another x. As you can see, the 25th X in line 8 lines up with the last X in line 5."
Guest [Entry]

"In the examples above, the byte-number is smaller than screen-column (e.g. 9-30, 7-25). This occurs when the displayed single-byte character takes up more than one screen-column.

It is also possible to have the byte-number be larger than the screen-column. This occurs when more than one byte is displayed in one (or fewer) column(s). An example is multi-byte characters such as '\xa0' (in hex notation) which may show up on the screen in a single column.

As an example, in line 5, if the second character is two-bytes and the fourth-character is also two bytes, as you move along line 5, the column numbers change as follows:

5,1
5,2 (two-byte character, appears in a single column)
5,4-3
5,5-4 (two-byte character, appears in a single column)
5,7-5"