From fab8621670f71637e9960003af28365129b1dfd0 Mon Sep 17 00:00:00 2001 From: Viacheslav Lotsmanov Date: Sun, 21 Jul 2019 19:27:08 +0300 Subject: [PATCH] Fix for "all" and "insert" "virtualedit" in Insert mode --- plugin/surround.vim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugin/surround.vim b/plugin/surround.vim index 5626f22..5909260 100644 --- a/plugin/surround.vim +++ b/plugin/surround.vim @@ -336,7 +336,16 @@ function! s:insert(...) " {{{1 if exists("g:surround_insert_tail") call setreg('"',g:surround_insert_tail,"a".getregtype('"')) endif - if col('.') >= col('$') + if &ve != 'all' && col('.') >= col('$') + if &ve == 'insert' + let extra_cols = virtcol('.') - virtcol('$') + if extra_cols > 0 + let [regval,regtype] = [getreg('"',1,1),getregtype('"')] + call setreg('"',join(map(range(extra_cols),'" "'),''),'v') + norm! ""p + call setreg('"',regval,regtype) + endif + endif norm! ""p else norm! ""P