In Vim statusline, right-pad number

691 Views Asked by At

Say I do set statusline+=col:%3v; in Vim 8.

Now if I'm on column 1, my statusline looks like col: 1;.

How do I get the padding on the other side of the number? E.g., how do I get my column 1 statusline to look like col:1 ;?

1

There are 1 best solutions below

1
hobbs On BEST ANSWER

Use %-3v. As documented in :help 'statusline:

field       meaning  
-           Left justify the item.  The default is right justified
            when minwid is larger than the length of the item.

This is also the convention used by printf, which vim is clearly imitating.