8 years ago
Same as <C-a>
and <C-x>
but multiplies and divides by [count]
instead.
TODO: make it repeatable.
function! Multivide(divide) let cnt = v:count1 let old_reg = getreg("v") let raw_number = getreg("v") call search('\d\([^0-9\.]\|$\)', 'cW') normal v call search('\(^\|[^0-9\.]\d\)', 'becW') normal "vygv if a:divide == 1 execute 'normal "_c' . @v / cnt else execute 'normal "_c' . @v * cnt endif call setreg("v", old_reg) endfunction nnoremap <key> :<C-u>call Multivide(0)<CR> nnoremap <key> :<C-u>call Multivide(1)<CR>