Handle any punctuation delimiters with cs and ds

This commit is contained in:
Danielle Sucher 2013-09-03 15:47:07 -07:00
parent 02199ea008
commit 7def4c0772

View File

@ -379,6 +379,12 @@ function! s:dosurround(...) " {{{1
let strcount = (scount == 1 ? "" : scount) let strcount = (scount == 1 ? "" : scount)
if char == '/' if char == '/'
exe 'norm! '.strcount.'[/d'.strcount.']/' 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 else
exe 'norm! d'.strcount.'i'.char exe 'norm! d'.strcount.'i'.char
endif endif
@ -403,6 +409,9 @@ function! s:dosurround(...) " {{{1
norm! "_x norm! "_x
call setreg('"','/**/',"c") call setreg('"','/**/',"c")
let keeper = substitute(substitute(keeper,'^/\*\s\=','',''),'\s\=\*$','','') let keeper = substitute(substitute(keeper,'^/\*\s\=','',''),'\s\=\*$','','')
elseif char =~# '[[:punct:]]' && char !~# '[][(){}<>]'
exe 'norm! F'.char
exe 'norm! df'.char
else else
" One character backwards " One character backwards
call search('.','bW') call search('.','bW')