Skip to content

Commit

Permalink
Merge pull request #107 from DanielleSucher/support-arbitrary-delimiters
Browse files Browse the repository at this point in the history
Handle arbitrary delimiters with cs and ds
  • Loading branch information
tpope committed Sep 9, 2013
2 parents 02199ea + 7def4c0 commit 9bf527a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions plugin/surround.vim
Expand Up @@ -379,6 +379,12 @@ function! s:dosurround(...) " {{{1
let strcount = (scount == 1 ? "" : scount)
if char == '/'
exe 'norm! '.strcount.'[/d'.strcount.']/'
elseif char =~# '[[:punct:]]' && char !~# '[][(){}<>]'
exe 'norm! T'.char
if getline('.')[col('.')-1] == char
exe 'norm! l'
endif
exe 'norm! dt'.char
else
exe 'norm! d'.strcount.'i'.char
endif
Expand All @@ -403,6 +409,9 @@ function! s:dosurround(...) " {{{1
norm! "_x
call setreg('"','/**/',"c")
let keeper = substitute(substitute(keeper,'^/\*\s\=','',''),'\s\=\*$','','')
elseif char =~# '[[:punct:]]' && char !~# '[][(){}<>]'
exe 'norm! F'.char
exe 'norm! df'.char
else
" One character backwards
call search('.','bW')
Expand Down

0 comments on commit 9bf527a

Please sign in to comment.