06/08/11 16:40:31
こんなかんじだろうか
function! CompleteMail(findstart, base)
if a:findstart
let str = getline(".")[: col('.') - 2]
let start = match(str, '[[:alnum:]_.-]*\%(@[[:alnum:]_.-]*\)\=$')
return start
else
redir => str
silent g/[[:alnum:]_.-]\+@[[:alnum:]_.-]\+/
redir END
let mx = '[[:alnum:]_.-]\+@[[:alnum:]_.-]\+'
let i = match(str, mx)
while !complete_check() && i != -1
let address = matchstr(str, mx, i)
if stridx(address, a:base) == 0
call complete_add(address)
endif
let i = match(str, mx, i + len(address))
endwhile
return []
endif
endfunction