From d12310f483c6d1015f70ed8b9bc1aa6dbda75c5d Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 31 Oct 2006 21:34:54 +0000 Subject: [PATCH] Allow newlines in closing (but not opening) of replacement --- plugin/surround.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugin/surround.vim b/plugin/surround.vim index 0d5c22c..596d46e 100644 --- a/plugin/surround.vim +++ b/plugin/surround.vim @@ -383,7 +383,7 @@ function! s:wrap(string,char,type,...) let before = before . "\n\t" endif if type ==# "v" - let after = "\n" . initspaces . after + let after = "\n". after endif endif endif @@ -422,6 +422,8 @@ function! s:wrap(string,char,type,...) let before = newchar let after = newchar endif + "let before = substitute(before,'\n','\n'.initspaces,'g') + let after = substitute(after ,'\n','\n'.initspaces,'g') if type ==# 'V' || (special && type ==# "v") let before = substitute(before,' \+$','','') let after = substitute(after ,'^ \+','','') @@ -503,6 +505,7 @@ function! s:insert(...) " {{{1 endif call search('\r','bW') return "\" + " Old implementation follows let @@ = reg_save "let text = s:wrap("\r",char,0) "call inputrestore()