mirror of
1
0
Fork 0

Update vim-surround.

This commit is contained in:
Kurtis Moxley 2022-05-19 23:31:58 +08:00
parent 315a7e1ebb
commit 25e4662559
2 changed files with 15 additions and 16 deletions

View File

@ -202,16 +202,4 @@ that allow you to jump to such markings.
>
let g:surround_insert_tail = "<++>"
<
ISSUES *surround-issues*
Vim could potentially get confused when deleting/changing occurs at the very
end of the line. Please report any repeatable instances of this.
Do we need to use |inputsave()|/|inputrestore()| with the tag replacement?
Indenting is handled haphazardly. Need to decide the most appropriate
behavior and implement it. Right now one can do :let b:surround_indent = 1
(or the global equivalent) to enable automatic re-indenting by Vim via |=|;
should this be the default?
vim:tw=78:ts=8:ft=help:norl:

View File

@ -323,7 +323,7 @@ function! s:insert(...) " {{{1
let cb_save = &clipboard
set clipboard-=unnamed clipboard-=unnamedplus
let reg_save = @@
call setreg('"',"\r",'v')
call setreg('"',"\032",'v')
call s:wrapreg('"',char,"",linemode)
" If line mode is used and the surrounding consists solely of a suffix,
" remove the initial newline. This fits a use case of mine but is a
@ -354,19 +354,21 @@ function! s:insert(...) " {{{1
call s:reindent()
endif
norm! `]
call search('\r','bW')
call search("\032",'bW')
let @@ = reg_save
let &clipboard = cb_save
return "\<Del>"
endfunction " }}}1
function! s:reindent() " {{{1
if exists("b:surround_indent") ? b:surround_indent : (!exists("g:surround_indent") || g:surround_indent)
function! s:reindent() abort " {{{1
if get(b:, 'surround_indent', get(g:, 'surround_indent', 1)) && (!empty(&equalprg) || !empty(&indentexpr) || &cindent || &smartindent || &lisp)
silent norm! '[=']
endif
endfunction " }}}1
function! s:dosurround(...) " {{{1
let sol_save = &startofline
set startofline
let scount = v:count1
let char = (a:0 ? a:1 : s:inputtarget())
let spc = ""
@ -388,6 +390,9 @@ function! s:dosurround(...) " {{{1
if a:0 > 1
let newchar = a:2
if newchar == "\<Esc>" || newchar == "\<C-C>" || newchar == ""
if !sol_save
set nostartofline
endif
return s:beep()
endif
endif
@ -414,6 +419,9 @@ function! s:dosurround(...) " {{{1
if keeper == ""
call setreg('"',original,otype)
let &clipboard = cb_save
if !sol_save
set nostartofline
endif
return ""
endif
let oldline = getline('.')
@ -478,6 +486,9 @@ function! s:dosurround(...) " {{{1
else
silent! call repeat#set("\<Plug>C".(a:0 > 2 && a:3 ? "S" : "s")."urround".char.newchar.s:input,scount)
endif
if !sol_save
set nostartofline
endif
endfunction " }}}1
function! s:changesurround(...) " {{{1