Created
June 11, 2012 01:38
-
-
Save Shougo/2908040 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! CompleteFiles(findstart, base) | |
if a:findstart | |
" Get cursor word. | |
let cur_text = strpart(getline('.'), 0, col('.') - 1) | |
return match(cur_text, '\f*$') | |
endif | |
echomsg printf('getline(".") = %s, a:base = %s', | |
\ getline('.'), a:base) | |
let words = split(expand(a:base . '*'), '\n') | |
let list = [] | |
let cnt = 0 | |
for word in words | |
call add(list, { 'word' : word, 'abbr' : printf('%3d: %s', cnt, word), 'menu' : 'file_complete' }) | |
let cnt += 1 | |
endfor | |
return list | |
endfunction | |
setlocal omnifunc=CompleteFiles |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment