Created
January 28, 2018 11:08
-
-
Save voyeg3r/c8e1820127e158a47d6ba0ee619c98bd to your computer and use it in GitHub Desktop.
This function creates a copy of any function increasing each number by one
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