Without changing anything the quickest way from that prompt is probably to press
:b + number + Enter. But as a bit of a shortcut here's what I (and a lot of other people) use that gets me there from Normal mode:
:nnoremap <leader>ls :ls<cr>:b
You can replace
<leader>ls with any unused Normal mode key combo. After pressing the keys you'll see the buffer list and you can enter the number + Enter without dealing with that
Press ENTER... prompt.
Update: OP would like to override
:ls altogether. That can be done with
:cnoremap ls ls<cr>:b
but this is not recommended since the mapping will happen anywhere "ls" is typed in a command or search term! (Thanks to Peter Rincker for the warning.) While you can overcome this by typing Ctrl+V before typing "ls" anywhere (e.g. to search for "hills" you'd have to do
/hil^Vls) that's hardly convenient. Better to choose a key-combo that is unlikely to occur in commands or search terms. In Vim help they have an example with "_ls" so
:cnoremap _ls ....
Update 2: I've since removed the
<space> from my own mapping and edited the mappings above to reflect this. It's not necessary and, more importantly, I occasionally decide I want to unload a buffer from this point using
<space> meant having to type Backspace before d and the buffer number.
Also, there supposedly was going to be an update five months ago based on a suggestion in the comments from @Rich but that seems to have fallen through the cracks 'til now...
He offers a more robust handling of a command-line override of
ls. His version behaves slightly differently from the
:cnoremap mapping above: the latter shows the buffer list after typing
ls while the other waits until a subsequent press of Enter. It's trivial to adapt his solution to match the above. Which one to choose is simply a matter of taste. Both have the benefit of avoiding any Ctrl-V nonsense and only activating upon typing
ls<CR> right after the command-line's opening
: versus activating inappropriately upon typing them somewhere else.
Here's the improved mapping to replace the one above. Simply add
<CR> after the first
ls to get the other flavor.
cnoremap <expr> ls (getcmdtype() == ':' && getcmdpos() == 1) ? "ls\<CR>:b" : "ls"
I recommend trying both and going with whatever suits you best but make sure you
:cunmap one before trying the other.
Or you can blow all of this off and just use
<leader>ls from Normal mode like most people prefer to do. :)