Skip to content

Commit fab8621

Browse files
unclechutpope
authored andcommitted
Fix for "all" and "insert" "virtualedit" in Insert mode
1 parent ca58a2d commit fab8621

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

plugin/surround.vim

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,16 @@ function! s:insert(...) " {{{1
336336
if exists("g:surround_insert_tail")
337337
call setreg('"',g:surround_insert_tail,"a".getregtype('"'))
338338
endif
339-
if col('.') >= col('$')
339+
if &ve != 'all' && col('.') >= col('$')
340+
if &ve == 'insert'
341+
let extra_cols = virtcol('.') - virtcol('$')
342+
if extra_cols > 0
343+
let [regval,regtype] = [getreg('"',1,1),getregtype('"')]
344+
call setreg('"',join(map(range(extra_cols),'" "'),''),'v')
345+
norm! ""p
346+
call setreg('"',regval,regtype)
347+
endif
348+
endif
340349
norm! ""p
341350
else
342351
norm! ""P

0 commit comments

Comments
 (0)