I recommend ido-mode
. It changes how completing-read
works, adding an inline display of possible matches, and adding several extra keyboard commands for manipulating the list. There are quite a lot of them, but the one I use most frequently is probably C-s
, which cycles the current list of matches so that the next one is selected.
In your example, C-x b sh
would match both shell buffers, and hitting enter would select the first one in the list (which would be whichever one you used most recently) and hitting C-s
would cycle that list to select the next one.
Additionally, if you customize ido-enable-flex-matching
then it won't require that what you type be an exact substring. You'll be able to type sh2
and have it match *shell*<2>
. I use this all the time.
Edit: While I was poking around in the source code, I noticed that you can customize the variable completion-category-overrides
to change how the default completing works. It's a little complicated, and the help strings aren't readily available in the customization interface as I'd prefer, but you should be able to figure it out. C-h v completing-styles-alist
will take you to the variable that holds information about the styles, which includes the help strings. It'll be easier to read them if you use the source link to jump to the file they're in, since the indentation will be better and it'll have syntax highlighting. Perhaps one of these styles will suit you better than the default. I still prefer ido-mode
though.