Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to show the current column in the statusbar, as is common in many other text editors. E.g. it's good to know if you are around column 80 or above.

How to show the current column in the statusbar?

share|improve this question

2 Answers

up vote 15 down vote accepted

Try if setting 'ruler' option is what you are looking for. On my computer at the bottom right shows the line and column where I have the cursor.

:set ruler

EDIT TO COMMENTS:

From the help of vim (command :help ruler):

If the number of characters displayed is different from the number of bytes in the text (e.g., for a TAB or a multi-byte character), both the text column (byte number) and the screen column are shown, separated with a dash.

You can try changing it with rulerformat option, like :set rulerformat=%l,%v

share|improve this answer
Yes, kind of. But that is showing a strange value e.g. 23,62-68 were 23 seem to be the line. How should I interpret 62-68 for the column? – Jonas Dec 6 '11 at 20:49
2  
62 is counting tabs as one character, 68 is counting expanded tabs – RedGrittyBrick Dec 6 '11 at 20:58
1  
From command ':help ruler': "If the number of characters displayed is different from the number of bytes in the text (e.g., for a TAB or a multi-byte character), both the text column (byte number) and the screen column are shown, separated with a dash." You can try changing it with 'rulerformat' option, like ':set rulerformat=%l,%v' – Birei Dec 6 '11 at 21:00
Thanks, maybe you should add that to your answer. – Jonas Dec 6 '11 at 23:36

See :help statusline for the many options available.

I have this in my ~/.vimrc in between a bunch of other directives:

set statusline+=col:\ %c,

which outputs

col: 64

in my statusline.

I don't have set ruler.

share|improve this answer
This doesn't work for me. I probably need some more settings. – Jonas Dec 6 '11 at 23:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.