Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions plugin/surround.vim
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function! s:inputtarget()
while c =~ '^\d\+$'
let c .= s:getchar()
endwhile
if c == " "
if c == " " || c == "\\"
let c .= s:getchar()
endif
if c =~ "\<Esc>\|\<C-C>\|\0"
Expand All @@ -35,7 +35,7 @@ endfunction

function! s:inputreplacement()
let c = s:getchar()
if c == " "
if c == " " || c == "\\"
let c .= s:getchar()
endif
if c =~ "\<Esc>" || c =~ "\<C-C>"
Expand Down Expand Up @@ -139,9 +139,9 @@ function! s:wrap(string,char,type,removed,special)
endif
let pairs = "b()B{}r[]a<>"
let extraspace = ""
if newchar =~ '^ '
if newchar =~ '^[\\ ]'
let extraspace = strpart(newchar,0,1)
let newchar = strpart(newchar,1)
let extraspace = ' '
endif
let idx = stridx(pairs,newchar)
if newchar == ' '
Expand Down Expand Up @@ -209,7 +209,7 @@ function! s:wrap(string,char,type,removed,special)
endif
endif
endif
elseif newchar ==# 'l' || newchar == '\'
elseif newchar ==# 'l'
" LaTeX
let env = input('\begin{')
if env != ""
Expand Down Expand Up @@ -360,6 +360,9 @@ function! s:dosurround(...) " {{{1
let scount = scount * matchstr(char,'^\d\+')
let char = substitute(char,'^\d\+','','')
endif
if char =~ '^\\'
let char = strpart(char,1)
endif
if char =~ '^ '
let char = strpart(char,1)
let spc = 1
Expand Down