function! Get_words_starting_with(head_str) let words = [] let lines = getline('1','$') for line in lines let str = matchstr(line, '\<' . a:head_str . '.\{-}\>') while str != "" let line = strpart(line, match(line, '\<' . a:head_str . '.\{-}\>') + 1) if count(words, str) == 0 call add(words, str) endif let str = matchstr(line, '\<' . a:head_str . '.\{-}\>') endwhile endfor return words endfunction