In the Vim statusline
, amongst the many flags you can set, there exist:
%c
-- column number, i.e. byte number.
%v
and %V
-- virtual column number, i.e. column number on your screen.
So what is the difference between the actual and virtual column number? The answer is, that when using tabs, the virtual column number is an approximation of your current column number as if you were using spaces instead of tabs.
Example. A useful combination in the Vim statusline is:
%c%V
As it says in the help, the %V flag, which displays the virtual column number, will only be printed (with a preceding dash) when it differs from the actual column number. Thus, normally your statusline would show only the real column number (e.g., 8
), but if you are on a line with tabs or multi-byte characters, you will see two numbers (e.g. 1-8
).
For instance, try this:
echo -e "\tHello world." > /tmp/test
Then, open /tmp/test
in Vim and notice your status line indicating the difference between the real and virtual columns. If you change the tabstop
setting to a different value, the virtual column will change.
Finally, if you :set expandtab
and do :retab
, then the virtual column indicator will be hidden.