Skip to content

Instantly share code, notes, and snippets.

@voyeg3r
Last active January 28, 2018 12:41
Show Gist options
  • Save voyeg3r/882151829f387702cb0f452c8bcaa78c to your computer and use it in GitHub Desktop.
Save voyeg3r/882151829f387702cb0f452c8bcaa78c to your computer and use it in GitHub Desktop.
this function increases each number in a copyied function or paragraph
fun! CopyAndIncrease()
try
let l:old_copy = getreg('0')
normal yip
let @0 = substitute(@0,'\d\+','\=submatch(0) + 1','g')
exec "normal }O\<Esc>p"
finally
call setreg('0', l:old_copy)
endtry
endfun
command! -nargs=0 CopyIncrease silent call CopyAndIncrease() | exec "normal \<Esc>"
let mapleader = ','
nnoremap <Leader>c :CopyIncrease<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment