Saturday, April 2, 2011

regarding completefunc

Hi all,
I would like to custom auto-complete function for my files. I can do
something like this as provided in vimdoc.
fun! CompleteMonths(findstart, base)
if a:findstart
" locate the start of the word
let line = getline('.')
let start = col('.') - 1
while start > 0 && line[start - 1] =~ '\a'
let start -= 1
endwhile
return start
else
" find months matching with "a:base"
let res = []
for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec")
if m =~ '^' . a:base
call add(res, m)
endif
endfor
return res
endif
endfun
set completefunc=CompleteMonths

But while showing in popup menu, i want different value to show. In
above example, When I type Ja, It shoulde show January(2011) in popup,
but when i select it should insert only Jan. Is there anyway to do
this.
Basically I want to show some more info to user, apart from auto-
complete string. Please help with this... this is very usefull for my
project.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment