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