On Sun, 21 May 2006, Yakov Lerner wrote:

I created systags per ':help ft-c-omni' suggestion:
 ctags -R -f ~/.vim/systags /usr/include /usr/local/include
and added systags to &tags (set tags+=~/.vim/systags).

Now I find that system() does not
appear in ~/.vim/systags generated as above. This is Linux, and
prototype for system() appears in /usr/include/stdlib.h

I realize this is ctags issue not vim issue, but maybe
someone knows what's the deal ? This is Linux

I notice the same thing.

After reading your mail, I was thinking about how the popup menu can be
made to show more information about the item currently being completed.
I was also thinking about standard functions that exist in different
programming languages (e.g., system() in the case of C).

Combining the two, it's about time someone cataloged the standard
functions with concise descriptions that will be displayed when the
omnicompletion popup menu is employed. For functions, the prototype can
be displayed to show what type of parameters the functions will accept,
and also the type of their return values.

This is not only limited to functions. It can be extended to standard
constants and typedefs, with brief descriptions of each shown in the
popup.

I went ahead and constructed what I call an "omnitags" file of the
standard C library, based on the ctags format at

  http://ctags.sourceforge.net/FORMAT

with reference to both these websites:

  http://www.utas.edu.au/infosys/info/documentation/C/CStdLib.html
  http://www.phim.unibe.ch/comp_doc/c_manual/C/FUNCTIONS/funcref.htm

and the GNU C library header files themselves.

So far, most of the functions have been included, among a few constants,
from these files:

  assert.h
  ctype.h
  math.h
  stdio.h
  stdlib.h
  string.h
  time.h

I try to stay faithful to a particular description format that's very
much like the library source code itself. At the moment, I haven't
written down the rules I followed, but I feel it's quite self
explanatory upon inspection.

The file "c_std_omnitags", included in the attachment, can be activated
by something like

  :set tags+=~/.vim/c_std_omnitags
  :setf c
  (then use Ctrl-x + Ctrl-o)

A FileType event can be made to add the omnitags file.

The file "c_std_omnitags_src" is essentially the same file, except that
the tags are sorted according to header files. Work is done on the src
file. All tags in the src need to be sorted in alphabetical order before
being applied to the 'tags' option.

I don't have much experience with omnicompletion and the intricacies of
C, so I'd like to ask everyone about this omnitags idea.

Would this be useful?
Has this sort of thing been implemented before for Vim?

If this is useful, perhaps we could form a support group to maintain
omnitags files from different languages, and also different variants of
the same language. The popup menu could be made to include a (cascaded)
description popup to allow for a multiple-line desciptions instead of
the current single-line descriptions.

Feedbacks appreciated :)
--
Gerald

Attachment: c_std_omnitags.tar.gz
Description: GNU Zip compressed data

Reply via email to