As title, if I\'m in the middle of function body and the function body is very long, how can I jump back to the beginning of the function body .
I spent hours to make this pattern: /^\s*\(\i\+\_[ \t\*]\+\)\+\i\+\_s*(\_[^)]*)\_s*{
, it works good for me.
EDIT: a better pattern(version 2): /\(\(if\|for\|while\|switch\|catch\)\_s*\)\@64
see the effect here:
you can map some convenient bindings in your .vimrc, such as:
" jump to the previous function
nnoremap [f :call search('^\s*\(\i\+\_[ \t\*]\+\)\+\i\+\_s*(\_[^)]*)\_s*{', "bw")
" jump to the next function
nnoremap ]f :call search('^\s*\(\i\+\_[ \t\*]\+\)\+\i\+\_s*(\_[^)]*)\_s*{', "w")
EDIT: a better pattern(version 2):
" jump to the previous function
nnoremap [f :call
\ search('\(\(if\\|for\\|while\\|switch\\|catch\)\_s*\)\@64
" jump to the next function
nnoremap ]f :call
\ search('\(\(if\\|for\\|while\\|switch\\|catch\)\_s*\)\@64