Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a file, which contains lines of function name, now I want to use them for code auto completion, and only for file names end with .XXX.

How should I do it, is it possible to work with ctags or Omni plugin?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You can use dictionary completion, i.e.

:setlocal dictionary+=/path/to/your/file

and then trigger the insert-mode completion with <C-x><C-k>; see :help i_CTRL-X_CTRL-K.

If you want this only for filetype xxx, put the :setlocal in ~/.vim/after/ftplugin/xxx.vim.

In contrast, Omni completion gives you more power, but you have to write the completion function yourself. (You could write a function that reads in your file, but why do all the effort when Vim has this built-in?!)

share|improve this answer
    
That worked after providing an extra au BufRead,BufNewFile *.idc set ft=idc line, but I still prefer OnmiFunc –  warl0ck May 6 '13 at 2:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.