vim - Prevent map from breaking on motion command error -
the thought have map allows me fold blocks of code enclosed in curly braces.
nnoremap zff 0f{zf%
this works expected on opening brace. next version seems work long { , } on same line. should on different lines though cursor jumps opening { , no fold created.
nnoremap zff 0f{f}zf%
edit:
the problem appears 1 time there error in 1 of motion commands map breaks. :silent!
prevents ex commands breaking map in case of error. there equivalent motion commands?
you're right error in command sequence breaks sequence, , right. if want go on in case of errors, execute commands separately through :normal!
. can chained in single command-line via :execute
:
nnoremap zff :exe 'normal! 0f{' | exe 'normal! f}' | exe 'normal! zf%'
vim
No comments:
Post a Comment