Experimental C comment support
This commit is contained in:
parent
a7208375e7
commit
714e9b8a61
@ -172,7 +172,10 @@ function! s:wrap(string,char,type,...)
|
|||||||
let extraspace = ' '
|
let extraspace = ' '
|
||||||
endif
|
endif
|
||||||
let idx = stridx(pairs,newchar)
|
let idx = stridx(pairs,newchar)
|
||||||
if exists("b:surround_".char2nr(newchar))
|
if newchar == ' '
|
||||||
|
let before = ''
|
||||||
|
let after = ''
|
||||||
|
elseif exists("b:surround_".char2nr(newchar))
|
||||||
let all = s:process(b:surround_{char2nr(newchar)})
|
let all = s:process(b:surround_{char2nr(newchar)})
|
||||||
let before = s:extractbefore(all)
|
let before = s:extractbefore(all)
|
||||||
let after = s:extractafter(all)
|
let after = s:extractafter(all)
|
||||||
@ -409,7 +412,12 @@ function! s:dosurround(...) " {{{1
|
|||||||
let original = getreg('"')
|
let original = getreg('"')
|
||||||
let otype = getregtype('"')
|
let otype = getregtype('"')
|
||||||
call setreg('"',"")
|
call setreg('"',"")
|
||||||
exe 'norm d'.(scount==1 ? "": scount)."i".char
|
let strcount = (scount == 1 ? "" : scount)
|
||||||
|
if char == '/'
|
||||||
|
exe 'norm '.strcount.'[/d'.strcount.']/'
|
||||||
|
else
|
||||||
|
exe 'norm d'.strcount.'i'.char
|
||||||
|
endif
|
||||||
"exe "norm vi".char."d"
|
"exe "norm vi".char."d"
|
||||||
let keeper = getreg('"')
|
let keeper = getreg('"')
|
||||||
let okeeper = keeper " for reindent below
|
let okeeper = keeper " for reindent below
|
||||||
@ -430,6 +438,10 @@ function! s:dosurround(...) " {{{1
|
|||||||
elseif char =~ "[\"'`]"
|
elseif char =~ "[\"'`]"
|
||||||
exe "norm! i \<Esc>d2i".char
|
exe "norm! i \<Esc>d2i".char
|
||||||
call setreg('"',substitute(getreg('"'),' ','',''))
|
call setreg('"',substitute(getreg('"'),' ','',''))
|
||||||
|
elseif char == '/'
|
||||||
|
norm! "_x
|
||||||
|
call setreg('"','/**/',"c")
|
||||||
|
let keeper = substitute(substitute(keeper,'^/\*\s\=','',''),'\s\=\*$','','')
|
||||||
else
|
else
|
||||||
exe "norm! da".char
|
exe "norm! da".char
|
||||||
endif
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user