sponsor Vim development Vim logo Vim Book Ad

funprototypes.vim : automatic insert function prototypes in your code

 script karma  Rating 24/9, Downloaded by 1035  Comments, bugs, improvements  Vim wiki

created by
Hong Wu
 
script type
utility
 
description
Introdution:
   This script is only for C language. You just press the key which you mapped
   can automatic insert/replace the all funtions' prototypes in your source code.
Preview:

    #include<stdio.h>

   // The  four lines below are automatic added by funprototypes.vim!
    /******************************************************"    
    **               funtion prototypes                 ***"            
    *******************************************************/"        
    void fun_1();                                              
    
    void
    fun_1(){
        printf("Hello, VIM!\n");
    }
    
    int main()
    {
       fun_1();
       return 0;
    }

Configure:
   1. let g:fun_prototypes_static_first = 0

      if g:fun_prototypes_static_first is 0, then the static functions will
      insert before the global funtions. <default is 0>

   2. let g:fun_prototypes_skip_fun_list=["main"]

      This list contains the functions which you don't want funprototypes.vim to add.
      eg:
         int main(){}  //skip
         int _main(){} //doesn't skip
      
   3. let g:fun_prototypes_static_fun_start_list=["static"]

      This list contains the functions which are defined as static/LOCAL functions.

   4. let g:fun_prototypes_header = /******************************************************"
      let g:fun_prototypes_body   = "**               funtion prototypes                 ***"
      let g:fun_prototypes_footer = *******************************************************/"

      These three lines will insert before first function define. If you only
      want single line, should define like below:
      eg:
      let g:fun_prototypes_header = ""
      let g:fun_prototypes_body   = "/***************funtion prototypes*******************/"
      let g:fun_prototypes_footer = ""
      Attention:If these three lines have already inserted in source code, the functions' prototypes will insert after these three lines!
Usage:
    Copy this file to ~/.vim/plugin or to /vimfiles/plugins/ (on win32)
    
    Add the key map (default is <leader>fd) in your .vimrc or _vimrc (on win32)
    default:
      nnoremap <silent> <leader>fd :call FunProto()<CR>
 
install details
copy funprototypes.vim to ~/.vim/plugin/
 

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
funprototypes.vim 1.2 2011-02-25 7.0 Hong Wu 1.2 fix bug: when first function define at line 1, the script go into an infinite    loop.
funprototypes.vim 1.1 2011-02-21 7.0 Hong Wu fix bug: the macro definition in comment & the cpp style comment(//....) above the function.
funprototypes.vim 1.0 2011-02-20 7.0 Hong Wu Initial upload
ip used for rating: 3.22.248.208

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.
   
Vim at Github