If you use the 35G
command instead of :35
, you can achieve this with the following mapping:
"[count]G Also open fold under cursor when supplying [count] (ie " jumping to a particular line, not the end of the " buffer). Use [count]|gg| if you don't want this. nnoremap <expr> G (v:count ? 'Gzv' : 'G')
For :35
, that would be hard to achieve. You will need to intercept <CR>
through :cmap <expr>
, check the entered command with getcmdtype()
and getcmdline()
, and if this number, manipulate the command, i.e. Add normal! zv
normal! zv
to her; eg:
cmap <expr> <CR> getcmdtype() == ':' && getcmdline() =~ '^\d\+$' ? 'normal! zv<CR>' : '<CR>'
source share