Question: I'm using vim and i want to switch between buffers by number.
(e.g when i press `Ctrl+2` vim should go to second buffer)

What should i write in `.vimrc`?

Answer: 
I would suggest:

```
" list buffers and jump to a chosen one
nnoremap <Leader>b :ls<CR>:b<Space>

```

The command `:ls<CR>` will list all opened buffers and `:b[uffer]<space>` allows you to type the number shown by the `ls`
The answer depends on the approach of working with buffers.

I use the following three ways:

* the buffers are showed in tabs;
* the buffers are showed in windows;
* the buffers can be hidden and the user switches between them using the current window.

For the first case, to switch between tabs, you may just type the buffer number and then hit the `g` and `t` keys. If it’s not suitable, make a map for the `gt` combination.

```
nnoremap <your_key_for_tab_switching> gt

```

For myself, I mapped the capital letters of the middle row, from “A” to “L”, for switching between tabs, but it may be not suitable for every user:

```
nnoremap A 1gt
nnoremap S 2gt
nnoremap D 3gt
...
nnoremap L 9gt

```

For switching between windows I prefer just the “next” and “prev” commands:

```
nnoremap <your_keys_to_the_next> <c-w>w
nnoremap <your_keys_to_the_prev> <c-w>W

```

To switch between opened but currently hidden buffers within a window you can:

```
nnoremap <your_shortcut_key> :buffer 
" there is a space after “buffer”

```

That will be exactly you’ve asked for — “by numbers”. But it’s not a convenient way as I think. I prefer to switch between hidden buffers by short names but it’s not a standard feature.

There is yet another way — capital letters and digits for the marks. See `help ma` for more information.

And a little piece of advice: consider using letter-like keyboard keys instead of the number keys because they are placed much more closely to the fingers.