2

I have remapped [ and ] to easily cycle through my open buffers. I don't understand why when I use this shortcut there is a delay of almost a second before the buffer is switched. This doesn't happen when I use gn or :bnext. This is how do mapping:

nnoremap <silent> ] :bnext<CR>
nnoremap <silent> [ :bprevious<CR>

Can you help me?

  • 4
    There are many other mappings that start with [ and ] so Vim is waiting to see if any more keys are going to be pressed. You can see a list of square bracket commands see :h [. Vim unimpaired uses [b and ]b for buffer commands if you are looking for ideas. – Peter Rincker Oct 13 '15 at 15:50
  • You can consider using a leader key (I use space) and map <leader> [ and ]. – user859 Oct 13 '15 at 16:01
2

This is because you probably have other mappings that start with [ or ].

You can get a list of all your active mappings by running :map.

You then have to get rid of the maps you don't want that start with [ (either in your vimrc or by finding out how to change the mappings for the plugin).

If you prefer, you can also remap to something more specific, for example [[ or ]]

  • 3
    There are actually built-in bindings that start with [ and ] (in fact, [[ and ]] are among them), so they wouldn't show up with :map [. – tommcdo Oct 17 '15 at 1:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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