AutoInclude is a script for Vim that automatically adds #include statements to your cc and hh files.
To use this script, simply place your cursor on the type that you need to include and press the corresponding key. This will automatically add the necessary #include statement to the file. In *.cc files, the correct #include will be added, while in *.hh files, the forward declaration is included.
For instance, if you have a function void myfunc (Foo* x); in your file and you place your cursor on "Foo" and hit the designated key, it will instantly add #include "foo.hh" at the top of the file. You can specify the insertion location for the #include statement using a variable.
The naming convention used by AutoInclude is "Foo" and "FooBar". For instance, if you have a class named FooBar, the #include statement added will be #include "foo-bar.hh".
To use this script, you'll need Vim. Installing AutoInclude is easy - just copy the autoinclude.vim file to your ~/.vim/plugin directory. You can specify where the #include statement will be added using the g:AutoIncludeLine variable. Simply add this line to your ~/.vimrc file:
let g:AutoIncludeLine = 42
Where 42 is the line number where you want the #include statement to be added. Overall, AutoInclude is an incredibly useful and time-saving Vim script that simplifies the process of adding #include statements to your code.
Version 1.0: N/A