sponsor Vim development Vim logo Vim Book Ad

autoincludex.vim : This script allows automatically insert statements like #include or import

 script karma  Rating 3/2, Downloaded by 666  Comments, bugs, improvements  Vim wiki

created by
Vadim Khohlov
 
script type
utility
 
description
Place the cursor on the type you need to include. If it is your class,
for example MyClass, enter in Normal mode:
       :call AutoIncludeCC()
The string #include "myclass.h" will be inserted in file.
For type from library, for example STL, enter:
       :call AutoIncludeLib("stl")
At first time you well be prompted to enter the correct header. You
should enter full text for include statement, i.e. with < >. In next
time this header will be inserted automatically even after reloading of   vim.
You can also place the special marks into file. For you types this is
the "project headers". In this case #include will be inserted after
line with this text:
   //project headers
   #include "myclass.h"
For type from the libraries this text is the "libname headers", where libname
is name of library:
   //stl headers
   #include <vector>

   //wx headers
   #include <wx/menu.h>

Of course, you can create map for calling of this function:
map ;; :call AutoIncludeCC()<cr>
map ;;w :call AutoIncludeLib("wx")<cr>
 
install details
Put autoincludex.vim file in your ~/.vim/plugin. Create directory
~/.vim/includesdb where databases of headers will be saved. You can use
any directory, but in this case you should set the variable
g:dict_inc_db_path in correct value.
 

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
autoincludex.vim 1.0 2008-09-01 6.0 Vadim Khohlov - bugfix of processing headers with \ and /
- Added options g:ainc_header_prefix and g:ainc_header_suffix. This options allows you to use script for other languages, such as php, python and so on. See description in comments.
autoincludex.vim 0.9 2008-08-31 6.0 Vadim Khohlov Initial upload
ip used for rating: 3.140.242.165

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