Just in case someone still wondering about this, now you can use autocmd.
autocmd CmdlineEnter /,\? :cnoremap <CR> <CR>zz
autocmd CmdlineLeave /,\? :cunmap <CR>
It's basically remap enter when in search mode and unmap if leave search mode. It was inpired by example from :help 'incsearch' and you can use it without incsearch.
EDIT:
If you don't want to to remap <CR> or enter when you use search as motion, you can do something like this:
augroup incsearch_center
autocmd CmdlineEnter /,\?
\ if empty(v:operator) |
\ cnoremap <CR> <CR>zz|
\ endif
autocmd CmdlineLeave /,\?
\ if empty(v:operator) |
\ cunmap <CR>|
\ endif
augroup END
v:operator is basically to check the last operator given in Normal mode such as c, d, and so on. For more info :help v:operator
If you want to use the accepted answer, you can use something like this:
cnoremap <expr> <CR> getcmdtype() =~ '[/?]' && empty(v:operator) ? '<CR>zz' : '<CR>'
getcmdtype() =~ '[?/]'would be a little easier. – Antony Dec 28 '16 at 13:49/as a motion: e.g.c/searchwill change from my current position to the next location matchingsearchbut, because of thecnoremap, insert the textzz. Thoughts on a workaround, or should I remove the mapping? – D. Ben Knoble Feb 17 '18 at 15:56