Strange vim registers behavior when used with execute "normal -


why following command not use content of first registered in unnamed register, if content number ?

execute "normal! cc".(@"+1)."\<esc>" 

this works, long default register contains only number. leading whitespace cause string evaluated 0.

:echo "1" + 1 2 :echo " 1" + 1 1 

you can avoid explicitly converting string number:

:echo str2nr(" 1") + 1 2 

note: if don't care 'autoindent' behavior of cc, use lower-level setline():

:call setline('.', str2nr(@") + 1) 

Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -