diff --git a/plugin/surround.vim b/plugin/surround.vim index 303bd2b..3e66158 100644 --- a/plugin/surround.vim +++ b/plugin/surround.vim @@ -35,6 +35,9 @@ endfunction function! s:inputreplacement() let c = s:getchar() + while c =~ '^\d\+$' + let c .= s:getchar() + endwhile if c == " " let c .= s:getchar() endif @@ -139,6 +142,11 @@ function! s:wrap(string,char,type,removed,special) endif let pairs = "b()B{}r[]a<>" let extraspace = "" + let multiplier = 1 + if newchar =~ '^\d\+' + let multiplier = matchstr(newchar, '^\d\+') + let newchar = substitute(newchar,'^\d\+','','') + endif if newchar =~ '^ ' let newchar = strpart(newchar,1) let extraspace = ' ' @@ -275,6 +283,8 @@ function! s:wrap(string,char,type,removed,special) let keeper = strcharpart(keeper,0,strchars(keeper) - 1) endif endif + let before = repeat(before, multiplier) + let after = repeat(after, multiplier) if type ==# 'V' let before = initspaces.before endif