ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: "Alexey I. Froloff" <raorn@immo.ru>
To: "ALT Devel discussion list" <devel@altlinux.ru>
Subject: [devel] Fwd: [Bram@: Occult completion]
Date: Sat, 10 Sep 2005 17:08:08 +0400
Message-ID: <20050910130808.GC26511@hell.immo.ru> (raw)

[-- Attachment #1: Type: text/plain, Size: 3971 bytes --]

FYI.

----- Forwarded message from Bram Moolenaar <Bram@> -----

Date: Sat, 10 Sep 2005 14:46:00 +0200
From: Bram Moolenaar <Bram@>
To: vim-dev@
Subject: Occult completion


I have made a start with "occult completion".  It's a bit like
intellisense completion, but that is a trademark.  It's going to be a
bit unpredictable and mysterious, thus "occult" seemed to be a good
name.  And I needed something starting with an O, so that CTRL-X CTRL-O
can be used.

It is currently only working for C.  This requires a tags file, which is
used to find the information about typedefs, structures, etc.  The
original ctags didn't include sufficient information, thus I made a
patch for Exuberant ctags to add this.  See the help text below for
where to find it.  Without this patch it will still work for some
things, depending on how the struct/typedef/etc. was declared.

In the latest snapshot the file that does the completion is:
runtime/autoload/ccomplete.vim.  If you see something that can be
improved, let me know.

You will obviously have remarks about what needs to be improved.  I'm
especially interested in suggestions with a hint about how it can be
implemented.  Or an example of how another program does this.

Do keep in mind that I want this to work on all systems, thus using some
.dll file (as the insenvim project is doing) is not an option.  We will
need a popup menu to show the alternatives.  This needs to be
implemented for various GUIs.  And for the console!

If you want to work on this for other languages that would be great.
C++ and Java should work in a similar way, since Exuberant ctags
supports them.


By the way: I fixed a problem that could cause a crash when using a
prompt in a :for loop.  The list that was looped over could be cleaned
up by the garbage collector (it kicks in when waiting for a character to
be typed).  This especially happened when an error message was given
inside a for loop, Vim could crash after the hit-enter prompt.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Filetype-specific remarks for occult completion	    *compl-occult-filetypes*

C							*ft-c-occult*

Completion requires a tags file.  You should use Exuberant ctags, because it
adds extra information that is needed for completion.  You can find it here:
http://ctags.sourceforge.net/
For version 5.5.4 you need to add a patch that adds the "typename:" field:
ftp://ftp.vim.org/pub/vim/unstable/patches/ctags-5.5.4.patch

If you want to complete system functions you can do something like this.  Use
ctags to generate a tags file for all the system header files: >
	% ctags -R -f ~/.vim/systags /usr/include /usr/local/include
In your vimrc file add this tags file to the 'tags' option: >
	set tags+=~/.vim/systags

When using CTRL-X CTRL-O after a name without any "." or "->" it is completed
from the tags file directly.  This works for any identifier, also function
names.  If you want to complete a local variable name, which does not appear
in the tags file, use CTRL-P instead.

When using CTRL-X CTRL-O after something that has "." or "->" Vim will attempt
to recognize the type of the variable and figure out what members it has.
This means only members valid for the variable will be listed.

Vim doesn't include a C compiler, only the most obviously formatted
declarations are recognized.  Preprocessor stuff may cause confusion.
When the same structure name appears in multiple places all possible members
are included.


-- 
$ echo pizza > /dev/oven

 /// Bram Moolenaar -- Bram@              -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\     Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html   ///

----- End forwarded message -----

-- 
Regards,
Sir Raorn.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2005-09-10 13:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-10 13:08 Alexey I. Froloff [this message]
2005-09-10 15:29 ` Alexey Rusakov
2005-09-10 18:58   ` Alexey I. Froloff
2005-09-10 22:35     ` Alexey I. Froloff
2005-09-12 14:46     ` Alexey Rusakov
2005-09-12 16:14       ` Alexey I. Froloff
2005-09-12 16:40         ` Alexey Rusakov
2005-09-12 17:10           ` Alexey I. Froloff
2005-09-12 17:25             ` Alexey Rusakov
2005-09-13 18:54           ` Alexey I. Froloff
2005-09-13 22:01             ` Alexey Rusakov
2005-09-14 10:20               ` Alexey I. Froloff
2005-09-14 22:51                 ` Alexey I. Froloff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050910130808.GC26511@hell.immo.ru \
    --to=raorn@immo.ru \
    --cc=devel@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git