sponsor Vim development Vim logo Vim Book Ad

code_complete (new update) : function parameter complete, code snippets, and much more.

 script karma  Rating 42/19, Downloaded by 2467  Comments, bugs, improvements  Vim wiki

created by
Wxyarv Wang
script type
see the origin script here:vimscript #1764
and there is a screenshot: http://files.myopera.com/mbbill/files/code_complete.gif

Install:          1.  Put code_complete.vim and my_snippets.template
                       to plugin directory.
                     2.  Use the command below to create tags file
                       including signature field.
                       ctags -R --c-kinds=+p --fields=+S .


                       "<A-d>" (default value of g:CodeCompl_Hotkey)
                       we DON'T use <tab>, because it comflict with
                       superstab.vim, you will quickly find Alt-S
                       will be a good choice.  Do all the jobs with
                       this key, see example:
                       press <A-d> after function name and (
                           foo ( <A-d>
                           foo ( `<first param>`,`<second param>` )
                       press <A-D> after code template
                           if <A-d>
                           if( `<...>` )


                           the key used to complete function
                           parameters and key words. after you press
                           ths key AFTER you input the complete-word,
                           the word will be spreaded. you can see the
                           paragraph above for detail features.

                       g:CodeCompl_RegionStart g:CodeCompl_RegionEnd
                           region start and stop you can change them
                           as you like.  but you must be careful,
                           because we use them to detemin marks in
                           your template files(not complete file), so
                           if you change it, maybe you must
                           substitute all marks in your template
                           files. after you change them, maybe you
                           should update your template file, you can
                           use this command:

                           you can use template file with
                           template-forechar, you can create a file
                           named 'complete-word.filetype',
                           and drop it in
                           g:CodeCompl_Template_Folder(default, it's
                           'templates' in your runtimepath, e.g.
                           D:\Vim\vimfiles\templates in windows, or
                           /root/.vim/templates in linux/unix.
                           after you create file, you can input
                           forechar + complete-word to include the
                           whole file. e.g. '#stdc' to include stdc.c
                           if your current filetype is 'c'.

                           see paragraph above. the folder default is

                           file name of users defined snippets.  now
                           it named 'my_snippets.template', use this
                           postfix to prevent Vim load it

                           see the Option section

                            Save complete list and template file list only in buffer

                   global helper functions:
                           same as g:CodeCompl_RegionStart . 'your
                           text' . g:CodeCompl_RegionEnd, but input a
                           little easily, but there are other helper
                           function and variables in your complete

                           file(defaults is my_snippets.template in
                           your plugin folder)

                   default complete-words:
                           see "my_snippets.template" file.
install details
Open .vba file with Vim, and type :so %.

or unwind it, and put templates folder into your .vim folder(or vimfiles folder in windows), put *.vim and *.template file into your plugin folder.

if you don't know Vimball, read this: vimscript #1502

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
code_complete.vba 2.8.1 2008-12-03 7.0 Wxyarv Wang bugfix, and change template marks diffevent with snippets marks. thanks to Scott Prager
code_complete.vba 2.8.1 2008-11-22 7.0 Wxyarv Wang add some helper function to build yourself snippets. and add some funny and useful snippets such as malloc, calloc and printf, you can try it youself, notice that they're only available when you set your filetype to c or cpp.

add some snippet for coding vim script.

all in all, this is just a little upgrade for more comfortable experience.
code_complete.vba 2.8.1 2008-11-11 7.0 Wxyarv Wang bugfix, and remove g:CodeCompl_UpdateAlways

make g:CodeCompl_SaveListInBuffer work, it replaced g:CodeCompl_UpdateAlways
code_complete.vba 2.8 2008-11-08 7.0 Wxyarv Wang still bugfix, now can input function declare like"func(int(*)(int,int),int) correctly.

change some snippets in my_snippets.template, but you'd better backup yourself snippet file.

add some user-command, you can read a short details in script file.

next version will make "save dict in global" work, but at least this is a stable version.
code_complete.zip 2.8 2008-11-06 7.0 Wxyarv Wang Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.