Update vim-surround.
This commit is contained in:
parent
315a7e1ebb
commit
25e4662559
2 changed files with 15 additions and 16 deletions
|
@ -202,16 +202,4 @@ that allow you to jump to such markings.
|
||||||
>
|
>
|
||||||
let g:surround_insert_tail = "<++>"
|
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:
|
vim:tw=78:ts=8:ft=help:norl:
|
||||||
|
|
|
@ -323,7 +323,7 @@ function! s:insert(...) " {{{1
|
||||||
let cb_save = &clipboard
|
let cb_save = &clipboard
|
||||||
set clipboard-=unnamed clipboard-=unnamedplus
|
set clipboard-=unnamed clipboard-=unnamedplus
|
||||||
let reg_save = @@
|
let reg_save = @@
|
||||||
call setreg('"',"\r",'v')
|
call setreg('"',"\032",'v')
|
||||||
call s:wrapreg('"',char,"",linemode)
|
call s:wrapreg('"',char,"",linemode)
|
||||||
" If line mode is used and the surrounding consists solely of a suffix,
|
" 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
|
" 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()
|
call s:reindent()
|
||||||
endif
|
endif
|
||||||
norm! `]
|
norm! `]
|
||||||
call search('\r','bW')
|
call search("\032",'bW')
|
||||||
let @@ = reg_save
|
let @@ = reg_save
|
||||||
let &clipboard = cb_save
|
let &clipboard = cb_save
|
||||||
return "\<Del>"
|
return "\<Del>"
|
||||||
endfunction " }}}1
|
endfunction " }}}1
|
||||||
|
|
||||||
function! s:reindent() " {{{1
|
function! s:reindent() abort " {{{1
|
||||||
if exists("b:surround_indent") ? b:surround_indent : (!exists("g:surround_indent") || g:surround_indent)
|
if get(b:, 'surround_indent', get(g:, 'surround_indent', 1)) && (!empty(&equalprg) || !empty(&indentexpr) || &cindent || &smartindent || &lisp)
|
||||||
silent norm! '[=']
|
silent norm! '[=']
|
||||||
endif
|
endif
|
||||||
endfunction " }}}1
|
endfunction " }}}1
|
||||||
|
|
||||||
function! s:dosurround(...) " {{{1
|
function! s:dosurround(...) " {{{1
|
||||||
|
let sol_save = &startofline
|
||||||
|
set startofline
|
||||||
let scount = v:count1
|
let scount = v:count1
|
||||||
let char = (a:0 ? a:1 : s:inputtarget())
|
let char = (a:0 ? a:1 : s:inputtarget())
|
||||||
let spc = ""
|
let spc = ""
|
||||||
|
@ -388,6 +390,9 @@ function! s:dosurround(...) " {{{1
|
||||||
if a:0 > 1
|
if a:0 > 1
|
||||||
let newchar = a:2
|
let newchar = a:2
|
||||||
if newchar == "\<Esc>" || newchar == "\<C-C>" || newchar == ""
|
if newchar == "\<Esc>" || newchar == "\<C-C>" || newchar == ""
|
||||||
|
if !sol_save
|
||||||
|
set nostartofline
|
||||||
|
endif
|
||||||
return s:beep()
|
return s:beep()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -414,6 +419,9 @@ function! s:dosurround(...) " {{{1
|
||||||
if keeper == ""
|
if keeper == ""
|
||||||
call setreg('"',original,otype)
|
call setreg('"',original,otype)
|
||||||
let &clipboard = cb_save
|
let &clipboard = cb_save
|
||||||
|
if !sol_save
|
||||||
|
set nostartofline
|
||||||
|
endif
|
||||||
return ""
|
return ""
|
||||||
endif
|
endif
|
||||||
let oldline = getline('.')
|
let oldline = getline('.')
|
||||||
|
@ -478,6 +486,9 @@ function! s:dosurround(...) " {{{1
|
||||||
else
|
else
|
||||||
silent! call repeat#set("\<Plug>C".(a:0 > 2 && a:3 ? "S" : "s")."urround".char.newchar.s:input,scount)
|
silent! call repeat#set("\<Plug>C".(a:0 > 2 && a:3 ? "S" : "s")."urround".char.newchar.s:input,scount)
|
||||||
endif
|
endif
|
||||||
|
if !sol_save
|
||||||
|
set nostartofline
|
||||||
|
endif
|
||||||
endfunction " }}}1
|
endfunction " }}}1
|
||||||
|
|
||||||
function! s:changesurround(...) " {{{1
|
function! s:changesurround(...) " {{{1
|
||||||
|
|
Loading…
Reference in a new issue