What is below the status line, and how to configure it?

13 views
Skip to first unread message

Dotan Cohen

unread,
Feb 12, 2012, 4:48:43 PM2/12/12
to vim use
In the final line of my terminal window in VIM I have a line that
serves several purposes:
1) When I first open a file, it shows the filename and some
attributes. The line also displays my current line number and column.
2) When I scroll, the filename disappears but the line number and
column remain (and are updated in real time).
3) When I search or start : commands (what are these commands called?)
then the line only shows the command or search term.

How is this line called, and how is it configured? I tried to
configure the status line, but adding laststatus=2 to .vimrc makes
_another_ line appear above it.

Thanks.

--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

Taylor Hedberg

unread,
Feb 12, 2012, 5:12:55 PM2/12/12
to vim...@googlegroups.com
I believe it's just called the "command line", and there's not that much
you can configure about it, other than controlling how many lines it
takes up and setting 'showcmd' so it shows normal-mode commands as you
type them. What did you want to change about it?

Dotan Cohen

unread,
Feb 13, 2012, 3:10:21 AM2/13/12
to vim...@googlegroups.com

Thanks, Taylor. I want to have it always show the filename, the buffer
number, and the amount of open buffers. I seems wasteful to me to put
that info on the statusline and then take up another valuable vertical
line.

Kazuo Teramoto

unread,
Feb 13, 2012, 4:52:53 AM2/13/12
to vim...@googlegroups.com
On Sun, Feb 12, 2012 at 11:48:43PM +0200, Dotan Cohen wrote:
> In the final line of my terminal window in VIM I have a line that
> serves several purposes:
> [...]

> How is this line called, and how is it configured? I tried to
> configure the status line, but adding laststatus=2 to .vimrc makes
> _another_ line appear above it.

One part of it is the command prompt, and you hardly can do anything
about it. But you can put info on 'ruler' that is on the right side of
command prompt setting 'rulerformat' for you preference. `help 'ruler'`
and `help 'rulerformat'` have more info on it.

Kazuo Teramoto

Taylor Hedberg

unread,
Feb 13, 2012, 9:41:45 AM2/13/12
to vim...@googlegroups.com
Dotan Cohen, Mon 2012-02-13 @ 10:10:21+0200:

> I want to have it always show the filename, the buffer number, and the
> amount of open buffers. I seems wasteful to me to put that info on the
> statusline and then take up another valuable vertical line.

I don't think that's possible. The job of the status line, as you
probably have guessed, is to display that very kind of information. The
command line is, of course, primarily for typing ex commands, and any
information it displays is going to be inherently ephemeral.

That's not to say it would be impossible to write a plugin that does it,
but it would be a bit of a hack, since that's not the command line's
intended purpose.

Andy Wokula

unread,
Feb 13, 2012, 10:23:03 AM2/13/12
to vim...@googlegroups.com
Am 13.02.2012 09:10, schrieb Dotan Cohen:
> On Mon, Feb 13, 2012 at 00:12, Taylor Hedberg<tmhe...@gmail.com> wrote:
>> I believe it's just called the "command line", and there's not that much
>> you can configure about it, other than controlling how many lines it
>> takes up and setting 'showcmd' so it shows normal-mode commands as you
>> type them. What did you want to change about it?
>
> Thanks, Taylor. I want to have it always show the filename, the buffer
> number, and the amount of open buffers. I seems wasteful to me to put
> that info on the statusline and then take up another valuable vertical
> line.

Not sure how useful that is, but 'ruler' can be customized with 'rulerformat':
:set ls=0 ru
:set ruf=%40(%n/%{bufnr('$')}\ %f%)
:h 'ruf

only useful with one window at a time, looks like above ruler only shows the
buffer number of the bottom window.
Also the ruler's display width seems restricted.

--
Andy

Dotan Cohen

unread,
Feb 13, 2012, 10:50:23 AM2/13/12
to vim...@googlegroups.com
On Mon, Feb 13, 2012 at 17:23, Andy Wokula <anw...@yahoo.de> wrote:
> Not sure how useful that is, but 'ruler' can be customized with
> 'rulerformat':
>    :set ls=0 ru
>    :set ruf=%40(%n/%{bufnr('$')}\ %f%)
>    :h 'ruf
>
> only useful with one window at a time, looks like above ruler only shows the
> buffer number of the bottom window.
> Also the ruler's display width seems restricted.
>

Thanks. Where is the set ruf line code documented? I figured out that
the leading %40 means forty characters' width, but I would really like
to see where this syntax is documented.

I did manage to find this page:
http://vim.1045645.n5.nabble.com/listing-total-number-of-buffers-in-the-statusline-td1189645.html

That page has this code for putting the current buffer number and the
total amount of buffers in the command line:
set rulerformat=%22(%{g:zbuflistcount};%M%n\ %=%l,%c%V\ %P%)
autocmd BufAdd * let g:zbuflistcount += 1
autocmd BufDelete * let g:zbuflistcount -= 1
autocmd VimEnter * call UpdateZBufLC()
function UpdateZBufLC()
let lst = range(1, bufnr('$'))
call filter(lst, 'buflisted(v:val)')
let g:zbuflistcount = len(lst)
endfunction

It doesn't show the filename, but this is close enough. I can always
Ctrl-G when I need the filename I suppose.

By the way, when I list the buffers with :ls, I cannot select 1, 2 to
select the first, second buffers. Is there supposed to be a way to do
this? I find that typing :b3 when the buffer list is open to be a bit
long for VIM, certainly there is a shorter way!

Thanks.

Jürgen Krämer

unread,
Feb 13, 2012, 11:01:20 AM2/13/12
to vim...@googlegroups.com

Hi,

Dotan Cohen wrote:
> On Mon, Feb 13, 2012 at 17:23, Andy Wokula <anw...@yahoo.de> wrote:
>> Not sure how useful that is, but 'ruler' can be customized with
>> 'rulerformat':
>> :set ls=0 ru
>> :set ruf=%40(%n/%{bufnr('$')}\ %f%)
>> :h 'ruf
>>
>> only useful with one window at a time, looks like above ruler only shows the
>> buffer number of the bottom window.
>> Also the ruler's display width seems restricted.
>>
>
> Thanks. Where is the set ruf line code documented? I figured out that
> the leading %40 means forty characters' width, but I would really like
> to see where this syntax is documented.

:help ruf

From there you are referred to

:help 'statusline'

Regards,
J�rgen

--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)

Dotan Cohen

unread,
Feb 13, 2012, 1:18:22 PM2/13/12
to vim...@googlegroups.com
On Mon, Feb 13, 2012 at 18:01, Jürgen Krämer <jott...@googlemail.com> wrote:
>> Thanks. Where is the set ruf line code documented? I figured out that
>> the leading %40 means forty characters' width, but I would really like
>> to see where this syntax is documented.
>
>  :help ruf
>
> From there you are referred to
>
>  :help 'statusline'
>
> Regards,
> Jürgen
>

Thank you!

I must say, I very much appreciate that you show me how I should have
gotten to :help 'statusline' instead of just telling me. That helps me
help myself in the future. Have a terrific week!

Reply all
Reply to author
Forward
0 new messages