From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Sat, 10 Sep 2005 17:08:08 +0400 From: "Alexey I. Froloff" To: "ALT Devel discussion list" Message-ID: <20050910130808.GC26511@hell.immo.ru> Mail-Followup-To: "ALT Devel discussion list" Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="s9fJI615cBHmzTOP" Content-Disposition: inline User-Agent: Mutt/1.5.10i Subject: [devel] Fwd: [Bram@: Occult completion] X-BeenThere: devel@altlinux.ru X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ALT Devel discussion list List-Id: ALT Devel discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2005 13:08:11 -0000 Archived-At: List-Archive: List-Post: --s9fJI615cBHmzTOP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable FYI. ----- Forwarded message from Bram Moolenaar ----- Date: Sat, 10 Sep 2005 14:46:00 +0200 =46rom: Bram Moolenaar 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 =2Edll 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. -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- 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. U= se 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+=3D~/.vim/systags When using CTRL-X CTRL-O after a name without any "." or "->" it is complet= ed =66rom 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 atte= mpt 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. --=20 $ 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 ----- --=20 Regards, Sir Raorn. --s9fJI615cBHmzTOP Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFDItq4VqT7+fkT8woRAi7AAJ9KEiMPfxF/5m4IIhKdlbNLiIOGqgCeIPIR 1kUHchTWnEKWGGENvXZdgDs= =W2WT -----END PGP SIGNATURE----- --s9fJI615cBHmzTOP--