diff options
Diffstat (limited to 'complete.vim')
-rw-r--r-- | complete.vim | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/complete.vim b/complete.vim new file mode 100644 index 0000000..2ada676 --- /dev/null +++ b/complete.vim @@ -0,0 +1,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 |