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

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

To switch between buffers without installing any plugins, a good way is to type

:b <tab>

Which shows all the current buffer names in status bar and you can pick one using cursor keys and enter.

But :b <tab> is 5 keystrokes and I would like to map it to a <leader>.

But setting the following is not working.

:nnoremap <Leader>. :b <Tab>

It shows ":b ^I" in status bar and doesn't actually open the buffer names on status bar.

Anyone knows why?

share|improve this question
the buffers (note the 's') command lists the buffers, while the buffer (no 's') command, when it is given an option, will change which buffer is shown in the window. – lornix Jul 6 '12 at 0:36
up vote 3 down vote accepted

You need to set the wildcharm setting. Try this:

set wildcharm=<Tab>
nnoremap <leader>. :b <Tab>

At least this works here.

share|improve this answer
Wow! Thank you. I've never heard/read about it. – romainl Jul 6 '12 at 7:56
YES! That fixed it!!! OSX on MacBook. Thank you:-) – CDR Jul 8 '12 at 5:50

I think that it has something to do with <tab> not being a real argument for :b.

If you drop the tab, as in nnoremap <leader>. :b<space> you can hit <tab> to get the menu.

You are down to 3 keystrokes to summon the menu but you may still have to hit <tab> more times to select the correct buffer and hit <CR>. That's a minimum of 4 keystrokes if you want the 1st buffer which is quite nice but what if you want the 7th or 12th buffer?

May I suggest another way?

nnoremap <leader>. :ls<CR>:b<Space>

With this mapping, a list of buffers (:ls) is displayed and the :b command is initiated, waiting for a buffer number as argument. That's 4 keystrokes (,.5<CR>), whatever buffer you want to jump to (well, if you have 10 or more buffers that would be 5 keystrokes but you get the point).

I don't know how you could make it shorter beside mapping a single key (like <F11> or whatever).

share|improve this answer

Your Answer


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.