aboutsummaryrefslogtreecommitdiffstats
path: root/autoload/xolox/misc/complete.vim
blob: 2ada67661089348b1b0eec8360a9623c00c4df6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
" Last Change: March 15, 2011
" URL: http://peterodding.com/code/vim/misc/

" Keyword completion from the current buffer for user defined commands.

function! xolox#misc#complete#keywords(arglead, cmdline, cursorpos)
  let words = {}
  for line in getline(1, '$')
    for word in split(line, '\W\+')
      let words[word] = 1
    endfor
  endfor
  return sort(keys(filter(words, 'v:key =~# a:arglead')))
endfunction

" vim: ts=2 sw=2 et