Last active
January 28, 2018 12:41
-
-
Save voyeg3r/882151829f387702cb0f452c8bcaa78c to your computer and use it in GitHub Desktop.
this function increases each number in a copyied function or paragraph
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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