views:

556

answers:

3

When I switch between buffers in vim with ":bn" and ":bp", my status line shows the following handy information:

"foo.txt" 43 lines --88%-- ((1) of 3)                      38,1          All

(I think it's "set showmode" that enables that.) But that "(1)" is always literally "(1)" -- it doesn't change as I change buffers. (The parens around the "1" are strange as well.)

Does anyone know how to fix that?

ADDED: It probably has to do with something nutty in my .vimrc, which is here: http://yootles.com/outbox/.vimrc


Relatedly, here's a handy trick to make switching buffers really painless (entries in .vimrc):

"left/right arrows to switch buffers in normal mode
map <right> :bn<cr>
map <left> :bp<cr>


Keywords to improve searchability: vim, multiple buffers, switching between buffers, strange status line. [Add others here if you were looking for answers to this question and didn't find this on your first attempt!]

+1  A: 

You can customize the looks of your statusline; for example, this is mine:

set laststatus=2    " all windows have statuslines
set statusline=%mb%n:%f%R%Y\ %l/%L,%c:%v


1st EDIT:

Try looking in the help for

:help arglist-position
:help shortmess

I never used these options, so I cannot give you a detailed explanation, but with a little reading you should get to the bottom of this.

ldigas
Ah, thanks; I will try that. I don't have my statusline set to anything now. I guess this is more of a workaround than a fix though, right? (Not that there's anything wrong with that, I'm just wondering if this is really a bug in vim or what.)
dreeves
@dreeves - Yes, this is more of a workaround. The problem is that I cannot reproduce the (...). That is not the default behaviour. "showmode" you mentioned has nothing to do with it, it just shows the mode you're in (e.g. --INSERT--, --NORMAL--). Could you add your vimrc in your post to help analyze
ldigas
Sure! yootles.com/outbox/.vimrc You're probably right that it's due to some craziness in my vimrc.
dreeves
+1  A: 

In my case status line is ok, but title of the gvim looks like you said.

You can consider changing both statusline and titlestring to the same value as they use the same pattern options.

For selecting buffers in a convenient way you can use
minibufexpl.vim : Elegant buffer explorer - takes very little screen space
http://www.vim.org/scripts/script.php?script_id=159

or
0scan : Tags based search for any things you might want to find(ctags, buffers,...).
http://www.vim.org/scripts/script.php?script_id=2507

Mykola Golubyev
+2  A: 

The reason vim shows ((1) of 3) is because of the argument list. When you started vim, you probably included 3 file names as arguments. Because you used :bn/:bp to switch buffers instead of :n/:N to move through the argument list, you're still on argument 1. Read :h arglist-position.

graywh