[SCM] vim-scripts packaging branch, master, updated. 94d6931b39bc216e79e1673187150bfec7383e86
James Vega
jamessan at debian.org
Wed Sep 2 03:33:52 UTC 2009
The following commit has been merged in the master branch:
commit 43334531448fa78b0f77c73e96ae38171a688271
Author: James Vega <jamessan at debian.org>
Date: Tue Sep 1 21:26:06 2009 -0400
Update DoxygenToolkit to 0.2.5
diff --git a/debian/changelog b/debian/changelog
index 9279ecc..3f79776 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,7 +5,9 @@ vim-scripts (20090211-2) UNRELEASED; urgency=low
* Remove git-commit script. Vim is shipped with more complete scripts.
(Closes: #539380)
* addons upgrades:
- - supertab
+ - supertab, DoxygenToolkit
+ * Add disabledby-doxygentoolkit.diff patch, which enables the commented out
+ plugin loaded check.
-- James Vega <jamessan at debian.org> Mon, 31 Aug 2009 18:14:35 -0400
diff --git a/debian/patches/disabledby-doxygentoolkit.diff b/debian/patches/disabledby-doxygentoolkit.diff
new file mode 100644
index 0000000..595075b
--- /dev/null
+++ b/debian/patches/disabledby-doxygentoolkit.diff
@@ -0,0 +1,19 @@
+Index: vim-scripts/plugin/DoxygenToolkit.vim
+===================================================================
+--- vim-scripts.orig/plugin/DoxygenToolkit.vim
++++ vim-scripts/plugin/DoxygenToolkit.vim
+@@ -215,10 +215,10 @@
+
+
+ " Verify if already loaded
+-"if exists("loaded_DoxygenToolkit")
+-" echo 'DoxygenToolkit Already Loaded.'
+-" finish
+-"endif
++if exists("loaded_DoxygenToolkit")
++ echo 'DoxygenToolkit Already Loaded.'
++ finish
++endif
+ let loaded_DoxygenToolkit = 1
+ "echo 'Loading DoxygenToolkit...'
+ let s:licenseTag = "Copyright (C) \<enter>"
diff --git a/debian/patches/series b/debian/patches/series
index 8cb86fc..d775eb8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -18,3 +18,4 @@ lbdbq-inputlist.diff
closetag-sanity.diff
lbdbq-query.diff
lbdbq-detect-lbdbq.diff
+disabledby-doxygentoolkit.diff
diff --git a/debian/vim-scripts.status b/debian/vim-scripts.status
index 3386dfd..a5e0f8b 100644
--- a/debian/vim-scripts.status
+++ b/debian/vim-scripts.status
@@ -291,14 +291,14 @@ version: 2.0
script_name: plugin/DoxygenToolkit.vim
addon: doxygen-toolkit
-description: simplify writing Doxygen documentation in C/C++
+description: simplify writing Doxygen documentation in C/C++, Python
script_url: http://www.vim.org/scripts/script.php?script_id=987
author: Mathias Lorente
author_url: http://www.vim.org/account/profile.php?user_id=5172
email: mathias_lorente at yahoo.fr
license: no license
disabledby: let loaded_DoxygenToolkit = 1
-version: 0.1.17
+version: 0.2.5
script_name: autoload/omni/cpp/complete.vim
addon: omnicppcomplete
diff --git a/html/index.html b/html/index.html
index 16aed58..0625070 100644
--- a/html/index.html
+++ b/html/index.html
@@ -50,7 +50,7 @@
<li><a href="syntax_mkd.vim.html">syntax/mkd.vim.html</a></li>
</ul>
<p>
- Page generated on Tue, 01 Sep 2009 20:43:20 -0400
+ Page generated on Tue, 01 Sep 2009 21:20:56 -0400
.
</p>
</body>
diff --git a/html/plugin_DoxygenToolkit.vim.html b/html/plugin_DoxygenToolkit.vim.html
index fee2434..9e2d6ce 100644
--- a/html/plugin_DoxygenToolkit.vim.html
+++ b/html/plugin_DoxygenToolkit.vim.html
@@ -3,7 +3,7 @@
<head>
<link rel="Stylesheet" type="text/css" href="/css/style.css" >
- <title>DoxygenToolkit.vim - Simplify Doxygen documentation in C, C++. : vim online</title>
+ <title>DoxygenToolkit.vim - Simplify Doxygen documentation in C, C++, Python. : vim online</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="KEYWORDS" content="Vim, Vi IMproved, text editor, home, documentation, tips, scripts, news">
<link rel="shortcut icon" type="image/x-icon" href="/images/vim_shortcut.ico">
@@ -46,6 +46,19 @@
<tr>
<td><small>not logged in (<a href="/login.php">login</a>)</small></td>
</tr>
+ <tr><td>
+<small> </small>
+<form action="http://www.google.com/cse" id="cse-search-box">
+ <div>
+ <input type="hidden" name="cx" value="partner-pub-3005259998294962:bvyni59kjr1" />
+ <input type="hidden" name="ie" value="ISO-8859-1" />
+ <input type="text" name="q" size="20" />
+ <br>
+ <input type="submit" name="sa" value="Search" />
+ </div>
+</form>
+<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script>
+ </td></tr>
<tr>
<td><img src="/images/spacer.gif" alt="" border="0" width="1" height="1"></td>
</tr>
@@ -59,7 +72,7 @@
<td class="sidebarheader"><a href="/index.php">Home</a></td>
</tr>
<tr>
- <td class="sidebarheader"><a href="/search.php">Search</a></td>
+ <td class="sidebarheader"><a href="/search.php">Advanced search</a></td>
</tr>
<tr>
<td><img src="/images/spacer.gif" alt="" border="0" width="1" height="7"></td>
@@ -143,7 +156,7 @@
<tr>
<td valign="top">
-<span class="txth1">DoxygenToolkit.vim : Simplify Doxygen documentation in C, C++.</span>
+<span class="txth1">DoxygenToolkit.vim : Simplify Doxygen documentation in C, C++, Python.</span>
<br>
<br>
@@ -153,8 +166,8 @@
<tr>
<td class="lightbg"><b> script karma </b></td>
<td>
- Rating <b>152/58</b>,
- Downloaded by 3059 </td>
+ Rating <b>208/90</b>,
+ Downloaded by 5501 </td>
</tr>
</table>
<p>
@@ -167,7 +180,7 @@
<tr><td>utility</td></tr>
<tr><td> </td></tr>
<tr><td class="prompt">description</td></tr>
-<tr><td>Actually five purposes have been defined :
<br>
<br>Generates a doxygen license comment. The tag text is configurable.
<br>
<br>Generates a doxygen author skeleton. The tag text is configurable.
<br>
<br>Generates a doxygen comment skeleton for a C, C++, or Java function or class,
<br>including @brief, @param (for each named argument), and @return. The tag
<br>text as well as a comment block header and footer are configurable.
<br>(Consequently, you can have \brief, etc. if you wish, with little effort.)
<br>
<br>Ignore code fragment placed in a block defined by #ifdef ... #endif. The
<br>block name must be given to the function. All of the corresponding blocks
<br>in all the file will be treated and placed in a new block DOX_SKIP_BLOCK (or
<br>any other name that you have configured). Then you have to update
<br>PREDEFINED value in your doxygen configuration file with correct block name.
<br>You also have to set ENABLE_PREPROCESSING to YES.
<br>
<br>Generate a doxygen group (begining and ending). The tag text is configurable.
<br>
<br>Use:
<br>- Type of comments ( /// or /** ... */ ) :
<br> In vim, default comments are : /** ... */. But if you prefer to use ///
<br> Doxygen comments just add 'let g:DoxygenToolkit_commentType = "C++"'
<br> (without quotes) in your .vimrc file
<br>
<br>- License :
<br> In vim, place the cursor on the line that will follow doxygen license
<br> comment. Then, execute the command :DoxLic. This will generate license
<br> comment and leave the cursor on the line just after.
<br>
<br>- Author :
<br> In vim, place the cursor on the line that will follow doxygen author
<br> comment. Then, execute the command :DoxAuthor. This will generate the
<br> skeleton and leave the cursor just after @author tag if no variable
<br> define it, or just after the skeleton.
<br>
<br>- Function / class comment :
<br> In vim, place the cursor on the line of the function header (or returned
<br> value of the function) or the class. Then execute the command :Dox.
<br> This will generate the skeleton and leave the cursor after the @brief tag.
<br>
<br>- Ignore code fragment :
<br> In vim, if you want to ignore all code fragment placed in a block such as :
<br> #ifdef DEBUG
<br> ...
<br> #endif
<br> You only have to execute the command :DoxUndoc(DEBUG) !
<br>
<br>- Group :
<br> In vim, execute the command :DoxBlock to insert a doxygen block on the
<br> following line.
<br>
<br>Limitations:
<br>- Assumes that the function name (and the following opening parenthesis) is
<br> at least on the third line after current cursor position.
<br>- Not able to update a comment block after it's been written.
<br>- Blocks delimiters (header and footer) are only included for function
<br> comment.
<br>
<br>Example:
<br>Given:
<br>int
<br> foo(char mychar,
<br> int myint,
<br> double* myarray,
<br> int mask = DEFAULT)
<br>{ //...
<br>}
<br>
<br>Issuing the :Dox command with the cursor on the return of the function
<br>declaration would generate
<br>
<br>/**
<br> * @brief
<br> *
<br> * @param mychar
<br> * @param myint
<br> * @param myarray
<br> * @param mask
<br> *
<br> * @return
<br> */
<br>
<br>
<br>To customize the output of the script, see the g:DoxygenToolkit_*
<br>variables in the script's source. These variables can be set in your
<br>.vimrc.
<br>
<br>For example, your .vimrc can contain:
<br>let g:DoxygenToolkit_blockHeader="--------------------------------------------------------------------------"
<br>let g:DoxygenToolkit_blockFooter="----------------------------------------------------------------------------"
<br>let g:DoxygenToolkit_authorName="Mathias Lorente"
<br>let g:DoxygenToolkit_licenseTag="My own license\<enter>" <-- Do not forget ending "\<enter>"
<br>let g:DoxygenToolkit_undocTag="DOXIGEN_SKIP_BLOCK"
<br># default use /**...*/ as comment. With this option /// comments are used.
<br>let g:DoxygenToolkit_commentType="C++"
<br>let g:DoxygenToolkit_briefTag_funcName = "yes" " to include function name between briefTag_pre and briefTag_post</td></tr>
+<tr><td>Currently five purposes have been defined :
<br>
<br>Generates a doxygen license comment. The tag text is configurable.
<br>
<br>Generates a doxygen author skeleton. The tag text is configurable.
<br>
<br>Generates a doxygen comment skeleton for a C, C++ or Python function or class,
<br>including @brief, @param (for each named argument), and @return. The tag
<br>text as well as a comment block header and footer are configurable.
<br>(Consequently, you can have \brief, etc. if you wish, with little effort.)
<br>
<br>Ignore code fragment placed in a block defined by #ifdef ... #endif (C/C++). The
<br>block name must be given to the function. All of the corresponding blocks
<br>in all the file will be treated and placed in a new block DOX_SKIP_BLOCK (or
<br>any other name that you have configured). Then you have to update
<br>PREDEFINED value in your doxygen configuration file with correct block name.
<br>You also have to set ENABLE_PREPROCESSING to YES.
<br>
<br>Generate a doxygen group (begining and ending). The tag text is
<br>configurable.
<br>
<br>Use:
<br>- Type of comments (C/C++: /// or /** ... */, Python: ## and # ) :
<br> In vim, default C++ comments are : /** ... */. But if you prefer to use ///
<br> Doxygen comments just add 'let g:DoxygenToolkit_commentType = "C++"'
<br> (without quotes) in your .vimrc file
<br>
<br>- License :
<br> In vim, place the cursor on the line that will follow doxygen license
<br> comment. Then, execute the command :DoxLic. This will generate license
<br> comment and leave the cursor on the line just after.
<br>
<br>- Author :
<br> In vim, place the cursor on the line that will follow doxygen author
<br> comment. Then, execute the command :DoxAuthor. This will generate the
<br> skeleton and leave the cursor just after @author tag if no variable
<br> define it, or just after the skeleton.
<br>
<br>- Function / class comment :
<br> In vim, place the cursor on the line of the function header (or returned
<br> value of the function) or the class. Then execute the command :Dox. This
<br> will generate the skeleton and leave the cursor after the @brief tag.
<br>
<br>- Ignore code fragment (C/C++ only) :
<br> In vim, if you want to ignore all code fragment placed in a block such as :
<br> #ifdef DEBUG
<br> ...
<br> #endif
<br> You only have to execute the command :DoxUndoc(DEBUG) !
<br>
<br>- Group :
<br> In vim, execute the command :DoxBlock to insert a doxygen block on the
<br> following line.
<br>
<br>Limitations:
<br>- Assumes that the function name (and the following opening parenthesis) is
<br> at least on the third line after current cursor position.
<br>- Not able to update a comment block after it's been written.
<br>- Blocks delimiters (header and footer) are only included for function
<br> comment.
<br>- Assumes that cindent is used.
<br>- Comments in function parameters (such as void foo(int bar /* ... */, baz))
<br> are not yet supported.
<br>
<br>
<br>Example:
<br>Given:
<br>int
<br> foo(char mychar,
<br> int myint,
<br> double* myarray,
<br> int mask = DEFAULT)
<br>{ //...
<br>}
<br>
<br>Issuing the :Dox command with the cursor on the function declaration would
<br>generate
<br>
<br>/**
<br> * @brief
<br> *
<br> * @param mychar
<br> * @param myint
<br> * @param myarray
<br> * @param mask
<br> *
<br> * @return
<br> */
<br>
<br>
<br>To customize the output of the script, see the g:DoxygenToolkit_*
<br>variables in the script's source. These variables can be set in your
<br>.vimrc.
<br>
<br>For example, my .vimrc contains:
<br>let g:DoxygenToolkit_briefTag_pre="@Synopsis "
<br>let g:DoxygenToolkit_paramTag_pre="@Param "
<br>let g:DoxygenToolkit_returnTag="@Returns "
<br>let g:DoxygenToolkit_blockHeader="--------------------------------------------------------------------------"
<br>let g:DoxygenToolkit_blockFooter="----------------------------------------------------------------------------"
<br>let g:DoxygenToolkit_authorName="Mathias Lorente"
<br>let g:DoxygenToolkit_licenseTag="My own license" <-- !!! Does not end with "\<enter>"</td></tr>
<tr><td> </td></tr>
<tr><td class="prompt">install details</td></tr>
<tr><td>Copy to your '~/.vim/plugin' directory</td></tr>
@@ -204,6 +217,54 @@ Click on the package to download.
<th valign="top">release notes</th>
</tr>
<tr>
+ <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=11228">DoxygenToolkit.vim</a></td>
+ <td class="rowodd" valign="top" nowrap><b>0.2.5</b></td>
+ <td class="rowodd" valign="top" nowrap><i>2009-08-21</i></td>
+ <td class="rowodd" valign="top" nowrap>7.0</td>
+ <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=5172">Mathias Lorente</a></i></td>
+ <td class="rowodd" valign="top" width="2000">DoxLic function is corrected (thanks to Roland Kammerer). Date and name are properly set.</td>
+</tr>
+<tr>
+ <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=10579">DoxygenToolkit.vim</a></td>
+ <td class="roweven" valign="top" nowrap><b>0.2.4</b></td>
+ <td class="roweven" valign="top" nowrap><i>2009-05-11</i></td>
+ <td class="roweven" valign="top" nowrap>7.0</td>
+ <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=5172">Mathias Lorente</a></i></td>
+ <td class="roweven" valign="top" width="2000">Bug correction (thanks to Anders Bo Rasmussen)
<br> - C++: now functions like void foo(type &bar); are correctly documented.
<br> The parameter's name is 'bar' (and no more '&bar').</td>
+</tr>
+<tr>
+ <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=10284">DoxygenToolkit.vim</a></td>
+ <td class="rowodd" valign="top" nowrap><b>0.2.3</b></td>
+ <td class="rowodd" valign="top" nowrap><i>2009-03-26</i></td>
+ <td class="rowodd" valign="top" nowrap>7.0</td>
+ <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=5172">Mathias Lorente</a></i></td>
+ <td class="rowodd" valign="top" width="2000">Added @version tag into the DocBlock generated by DoxygenAuthorFunc() (thanks to Dave Walter).</td>
+</tr>
+<tr>
+ <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=9847">DoxygenToolkit.vim</a></td>
+ <td class="roweven" valign="top" nowrap><b>0.2.2</b></td>
+ <td class="roweven" valign="top" nowrap><i>2009-01-20</i></td>
+ <td class="roweven" valign="top" nowrap>7.0</td>
+ <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=5172">Mathias Lorente</a></i></td>
+ <td class="roweven" valign="top" width="2000">Comments are now allowed in function declaration. Example:
<br>- C/C++: void func( int foo, // first param
<br> int bar /* second param */);
<br>
<br>- Python: def func( foo, # first param
<br> bar ) # second param</td>
+</tr>
+<tr>
+ <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=9823">DoxygenToolkit.vim</a></td>
+ <td class="rowodd" valign="top" nowrap><b>0.2.1</b></td>
+ <td class="rowodd" valign="top" nowrap><i>2009-01-15</i></td>
+ <td class="rowodd" valign="top" nowrap>7.0</td>
+ <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=5172">Mathias Lorente</a></i></td>
+ <td class="rowodd" valign="top" width="2000">Bug correction (many thanks to Alexey Radkov)
<br>- C/C++: following function/method are now correctly documented:
<br> - operator(),
<br> - constructor with initialization parameter(s),
<br> - pure virtual method,
<br> - const method.
<br>
<br>- Python:
<br> - Single line function are now correctly documented.</td>
+</tr>
+<tr>
+ <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=9809">DoxygenToolkit.vim</a></td>
+ <td class="roweven" valign="top" nowrap><b>0.2.0</b></td>
+ <td class="roweven" valign="top" nowrap><i>2009-01-13</i></td>
+ <td class="roweven" valign="top" nowrap>7.0</td>
+ <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=5172">Mathias Lorente</a></i></td>
+ <td class="roweven" valign="top" width="2000">The main function has been rewritten (I hope it is cleaner).
<br> - There is now support for function pointer as parameter (C/C++).
<br> - You can configure the script to get one line documentation (for
<br> attribute instance for example, you need to set
<br> g:DoxygenToolkit_compactOneLineDoc to "yes").
<br>
<br> - NEW: Support Python scripts:
<br> - Function/method are not scanned, so by default they are considered
<br> as if they always return something (modify this behavior by defining
<br> g:DoxygenToolkit_python_autoFunctionReturn to "no")
<br> - self parameter is automatically ignored when scanning function
<br> parameters (you can change this behavior by defining
<br> g:DoxygenToolkit_python_autoRemoveSelfParam to "no")</td>
+</tr>
+<tr>
<td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=6978">DoxygenToolkit.vim</a></td>
<td class="rowodd" valign="top" nowrap><b>0.1.17</b></td>
<td class="rowodd" valign="top" nowrap><i>2007-04-15</i></td>
@@ -321,6 +382,7 @@ Click on the package to download.
</tr>
</table>
</td>
+
</tr>
</table>
@@ -359,8 +421,7 @@ Click on the package to download.
</td>
<td align="right" valign="top">
- <a href="http://www.webconceptgroup.net"><img src="/images/logo_sponsor_wcg.jpg" width="131" height="30" border="0" alt="Sponsored by Web Concept Group Inc."></a>
- <a href="http://sourceforge.net"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=8&type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a>
+ <a href="http://sourceforge.net/projects/vim" rel="nofollow"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=8&type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a>
</td>
<td><img src="/images/spacer.gif" width="5" height="1" alt=""></td>
diff --git a/plugin/DoxygenToolkit.vim b/plugin/DoxygenToolkit.vim
index a6a2ae1..465c934 100644
--- a/plugin/DoxygenToolkit.vim
+++ b/plugin/DoxygenToolkit.vim
@@ -1,9 +1,57 @@
" DoxygenToolkit.vim
" Brief: Usefull tools for Doxygen (comment, author, license).
-" Version: 0.1.17
-" Date: 04/15²07
+" Version: 0.2.5
+" Date: 08/20/09
" Author: Mathias Lorente
"
+" TODO: add automatically (option controlled) in/in out flags to function
+" parameters
+" TODO: (Python) Check default paramareters defined as list/dictionnary/tuple
+"
+" Note: Corrected DoxLic function which should have been corrupted since version
+" 0.2.0 (thanks to Roland Kammerer). Date and name are properly set.
+"
+" Note: Added @version tag into the DocBlock generated by DoxygenAuthorFunc()
+" (thanks to Dave Walter).
+" The version string can be defines into your .vimrc file with
+" g:DoxygenToolkit_versionString or it will be asked the first time the
+" function is called (same behavior as @author tag). Example:
+" /// \file foo.cpp
+" /// \brief
+" /// \author Dave Walter
+" /// \version 1.0
+" /// \date 2009-03-26
+"
+" Note: Comments are now allowed in function declaration. Example:
+" - C/C++: void func( int foo, // first param
+" int bar /* second param */ );
+"
+" - Python: def func( foo, # first param
+" bar ) # second param
+"
+" Note: Bug correction (many thanks to Alexey Radkov)
+" - C/C++: following function/method are now correctly documented:
+" - operator(),
+" - constructor with initialization parameter(s),
+" - pure virtual method,
+" - const method.
+" - Python:
+" - Single line function are now correctly documented.
+"
+" Note: The main function has been rewritten (I hope it is cleaner).
+" - There is now support for function pointer as parameter (C/C++).
+" - You can configure the script to get one line documentation (for
+" attribute instance for example, you need to set
+" g:DoxygenToolkit_compactOneLineDoc to "yes").
+"
+" - NEW: Support Python scripts:
+" - Function/method are not scanned, so by default they are considered
+" as if they always return something (modify this behavior by defining
+" g:DoxygenToolkit_python_autoFunctionReturn to "no")
+" - self parameter is automatically ignored when scanning function
+" parameters (you can change this behavior by defining
+" g:DoxygenToolkit_python_autoRemoveSelfParam to "no")
+"
" Note: Number of lines scanned is now configurable. Default value is still 10
" lines. (Thanks to Spencer Collyer for this improvement).
"
@@ -61,18 +109,18 @@
" - Fixed errors with function with no indentation.
"
"
-" Actually five purposes have been defined :
+" Currently five purposes have been defined :
"
" Generates a doxygen license comment. The tag text is configurable.
"
" Generates a doxygen author skeleton. The tag text is configurable.
"
-" Generates a doxygen comment skeleton for a C, C++, or Java function or class,
+" Generates a doxygen comment skeleton for a C, C++ or Python function or class,
" including @brief, @param (for each named argument), and @return. The tag
" text as well as a comment block header and footer are configurable.
" (Consequently, you can have \brief, etc. if you wish, with little effort.)
"
-" Ignore code fragment placed in a block defined by #ifdef ... #endif. The
+" Ignore code fragment placed in a block defined by #ifdef ... #endif (C/C++). The
" block name must be given to the function. All of the corresponding blocks
" in all the file will be treated and placed in a new block DOX_SKIP_BLOCK (or
" any other name that you have configured). Then you have to update
@@ -83,8 +131,8 @@
" configurable.
"
" Use:
-" - Type of comments ( /// or /** ... */ ) :
-" In vim, default comments are : /** ... */. But if you prefer to use ///
+" - Type of comments (C/C++: /// or /** ... */, Python: ## and # ) :
+" In vim, default C++ comments are : /** ... */. But if you prefer to use ///
" Doxygen comments just add 'let g:DoxygenToolkit_commentType = "C++"'
" (without quotes) in your .vimrc file
"
@@ -121,7 +169,9 @@
" - Not able to update a comment block after it's been written.
" - Blocks delimiters (header and footer) are only included for function
" comment.
-" - Assumes that cindent is used.
+" - Assumes that cindent is used.
+" - Comments in function parameters (such as void foo(int bar /* ... */, baz))
+" are not yet supported.
"
"
" Example:
@@ -138,15 +188,15 @@
" generate
"
" /**
-" * @brief
-" *
-" * @param mychar
-" * @param myint
-" * @param myarray
-" * @param mask
-" *
-" * @return
-" */
+" * @brief
+" *
+" * @param mychar
+" * @param myint
+" * @param myarray
+" * @param mask
+" *
+" * @return
+" */
"
"
" To customize the output of the script, see the g:DoxygenToolkit_*
@@ -160,15 +210,15 @@
" let g:DoxygenToolkit_blockHeader="--------------------------------------------------------------------------"
" let g:DoxygenToolkit_blockFooter="----------------------------------------------------------------------------"
" let g:DoxygenToolkit_authorName="Mathias Lorente"
-" let g:DoxygenToolkit_licenseTag="My own license\<enter>" <-- Do not forget
-" ending "\<enter>"
+" let g:DoxygenToolkit_licenseTag="My own license" <-- Does not end with
+" "\<enter>"
" Verify if already loaded
-if exists("loaded_DoxygenToolkit")
- "echo 'DoxygenToolkit Already Loaded.'
- finish
-endif
+"if exists("loaded_DoxygenToolkit")
+" echo 'DoxygenToolkit Already Loaded.'
+" finish
+"endif
let loaded_DoxygenToolkit = 1
"echo 'Loading DoxygenToolkit...'
let s:licenseTag = "Copyright (C) \<enter>"
@@ -186,352 +236,172 @@ let s:licenseTag = s:licenseTag . "Foundation, Inc., 59 Temple Place - Suite 330
" Common standard constants
if !exists("g:DoxygenToolkit_briefTag_pre")
- let g:DoxygenToolkit_briefTag_pre = "@brief "
+ let g:DoxygenToolkit_briefTag_pre = "@brief "
endif
if !exists("g:DoxygenToolkit_briefTag_post")
- let g:DoxygenToolkit_briefTag_post = ""
+ let g:DoxygenToolkit_briefTag_post = ""
endif
if !exists("g:DoxygenToolkit_paramTag_pre")
- let g:DoxygenToolkit_paramTag_pre = "@param "
+ let g:DoxygenToolkit_paramTag_pre = "@param "
endif
if !exists("g:DoxygenToolkit_paramTag_post")
- let g:DoxygenToolkit_paramTag_post = " "
+ let g:DoxygenToolkit_paramTag_post = ""
endif
if !exists("g:DoxygenToolkit_returnTag")
- let g:DoxygenToolkit_returnTag = "@return "
+ let g:DoxygenToolkit_returnTag = "@return "
endif
if !exists("g:DoxygenToolkit_blockHeader")
- let g:DoxygenToolkit_blockHeader = ""
+ let g:DoxygenToolkit_blockHeader = ""
endif
if !exists("g:DoxygenToolkit_blockFooter")
- let g:DoxygenToolkit_blockFooter = ""
+ let g:DoxygenToolkit_blockFooter = ""
endif
if !exists("g:DoxygenToolkit_licenseTag")
- let g:DoxygenToolkit_licenseTag = s:licenseTag
+ let g:DoxygenToolkit_licenseTag = s:licenseTag
endif
if !exists("g:DoxygenToolkit_fileTag")
- let g:DoxygenToolkit_fileTag = "@file "
+ let g:DoxygenToolkit_fileTag = "@file "
endif
if !exists("g:DoxygenToolkit_authorTag")
- let g:DoxygenToolkit_authorTag = "@author "
+ let g:DoxygenToolkit_authorTag = "@author "
endif
if !exists("g:DoxygenToolkit_dateTag")
- let g:DoxygenToolkit_dateTag = "@date "
+ let g:DoxygenToolkit_dateTag = "@date "
+endif
+if !exists("g:DoxygenToolkit_versionTag")
+ let g:DoxygenToolkit_versionTag = "@version "
endif
if !exists("g:DoxygenToolkit_undocTag")
- let g:DoxygenToolkit_undocTag = "DOX_SKIP_BLOCK"
+ let g:DoxygenToolkit_undocTag = "DOX_SKIP_BLOCK"
endif
if !exists("g:DoxygenToolkit_blockTag")
- let g:DoxygenToolkit_blockTag = "@name "
+ let g:DoxygenToolkit_blockTag = "@name "
endif
if !exists("g:DoxygenToolkit_classTag")
- let g:DoxygenToolkit_classTag = "@class "
+ let g:DoxygenToolkit_classTag = "@class "
endif
if !exists("g:DoxygenToolkit_cinoptions")
- let g:DoxygenToolkit_cinoptions = "c1C1"
+ let g:DoxygenToolkit_cinoptions = "c1C1"
endif
if !exists("g:DoxygenToolkit_startCommentTag ")
- let g:DoxygenToolkit_startCommentTag = "/** "
- let g:DoxygenToolkit_startCommentBlock = "/* "
+ let g:DoxygenToolkit_startCommentTag = "/** "
+ let g:DoxygenToolkit_startCommentBlock = "/* "
endif
if !exists("g:DoxygenToolkit_interCommentTag ")
- let g:DoxygenToolkit_interCommentTag = "* "
+ let g:DoxygenToolkit_interCommentTag = "* "
+endif
+if !exists("g:DoxygenToolkit_interCommentBlock ")
+ let g:DoxygenToolkit_interCommentBlock = "* "
endif
if !exists("g:DoxygenToolkit_endCommentTag ")
- let g:DoxygenToolkit_endCommentTag = "*/"
- let g:DoxygenToolkit_endCommentBlock = " */"
+ let g:DoxygenToolkit_endCommentTag = "*/"
+ let g:DoxygenToolkit_endCommentBlock = "*/"
endif
if exists("g:DoxygenToolkit_commentType")
- if ( g:DoxygenToolkit_commentType == "C++" )
- let g:DoxygenToolkit_startCommentTag = "/// "
- let g:DoxygenToolkit_interCommentTag = "/// "
- let g:DoxygenToolkit_endCommentTag = ""
- let g:DoxygenToolkit_startCommentBlock = "// "
- let g:DoxygenToolkit_endCommentBlock = ""
- endif
+ if ( g:DoxygenToolkit_commentType == "C++" )
+ let g:DoxygenToolkit_startCommentTag = "/// "
+ let g:DoxygenToolkit_interCommentTag = "/// "
+ let g:DoxygenToolkit_endCommentTag = ""
+ let g:DoxygenToolkit_startCommentBlock = "// "
+ let g:DoxygenToolkit_interCommentBlock = "// "
+ let g:DoxygenToolkit_endCommentBlock = ""
+ else
+ let g:DoxygenToolkit_commentType = "C"
+ endif
else
- let g:DoxygenToolkit_commentType = "C"
+ let g:DoxygenToolkit_commentType = "C"
endif
+" Compact documentation
+" /**
+" * \brief foo ---> /** \brief foo */
+" */
+if !exists("g:DoxygenToolkit_compactOneLineDoc")
+ let g:DoxygenToolkit_compactOneLineDoc = "no"
+endif
+" /**
+" * \brief foo /**
+" * * \brief foo
+" * \param bar ---> * \param bar
+" * * \return
+" * \return */
+" */
+if !exists("g:DoxygenToolkit_compactDoc")
+ let g:DoxygenToolkit_compactDoc = "no"
+endif
+
+" Necessary '\<' and '\>' will be added to each item of the list.
+let s:ignoreForReturn = ['template', 'explicit', 'inline', 'static', 'virtual', 'void\([[:blank:]]*\*\)\@!', 'const', 'volatile']
if !exists("g:DoxygenToolkit_ignoreForReturn")
- let g:DoxygenToolkit_ignoreForReturn = "inline static virtual void"
+ let g:DoxygenToolkit_ignoreForReturn = s:ignoreForReturn[:]
else
- let g:DoxygenToolkit_ignoreForReturn = g:DoxygenToolkit_ignoreForReturn . " inline static virtual void"
+ let g:DoxygenToolkit_ignoreForReturn += s:ignoreForReturn
endif
+unlet s:ignoreForReturn
" Maximum number of lines to check for function parameters
if !exists("g:DoxygenToolkit_maxFunctionProtoLines")
- let g:DoxygenToolkit_maxFunctionProtoLines = 10
+ let g:DoxygenToolkit_maxFunctionProtoLines = 10
endif
-" Add name of function after pre brief tag if you want
+" Add name of function/class/struct... after pre brief tag if you want
+if !exists("g:DoxygenToolkit_briefTag_className")
+ let g:DoxygenToolkit_briefTag_className = "no"
+endif
+if !exists("g:DoxygenToolkit_briefTag_structName")
+ let g:DoxygenToolkit_briefTag_structName = "no"
+endif
+if !exists("g:DoxygenToolkit_briefTag_enumName")
+ let g:DoxygenToolkit_briefTag_enumName = "no"
+endif
+if !exists("g:DoxygenToolkit_briefTag_namespaceName")
+ let g:DoxygenToolkit_briefTag_namespaceName = "no"
+endif
if !exists("g:DoxygenToolkit_briefTag_funcName")
- let g:DoxygenToolkit_briefTag_funcName = "no"
+ let g:DoxygenToolkit_briefTag_funcName = "no"
endif
+" Keep empty line (if any) between comment and function/class/...
+if !exists("g:DoxygenToolkit_keepEmptyLineAfterComment")
+ let g:DoxygenToolkit_keepEmptyLineAfterComment = "no"
+endif
-""""""""""""""""""""""""""
-" Doxygen comment function
-""""""""""""""""""""""""""
-function! <SID>DoxygenCommentFunc()
- " Store indentation
- let l:oldcinoptions = &cinoptions
- " Set new indentation
- let &cinoptions=g:DoxygenToolkit_cinoptions
-
- let l:argBegin = "\("
- let l:argEnd = "\)"
- let l:argSep = ','
- let l:sep = "\ "
- let l:voidStr = "void"
-
- let l:classDef = 0
-
- " Save standard comment expension
- let l:oldComments = &comments
- let &comments = ""
-
- " Store function in a buffer
- let l:lineBuffer = getline(line("."))
- mark d
- let l:count=1
- " Return of function can be defined on other line than the one of the
- " function.
- while ( l:lineBuffer !~ l:argBegin && l:count < 4 )
- " This is probbly a class (or something else definition)
- if ( l:lineBuffer =~ "{" || l:lineBuffer =~ ";" )
- let l:classDef = 1
- break
- endif
- exec "normal j"
- let l:line = getline(line("."))
- let l:lineBuffer = l:lineBuffer . ' ' . l:line
- let l:count = l:count + 1
- endwhile
- if ( l:classDef == 0 )
- if ( l:count == 4 )
- " Restore standard comment expension
- let &comments = l:oldComments
- " Restore indentation
- let &cinoptions = l:oldcinoptions
- return
- endif
- " Get the entire function
- let l:count = 0
- while ( l:lineBuffer !~ l:argEnd && l:count < g:DoxygenToolkit_maxFunctionProtoLines )
- exec "normal j"
- let l:line = getline(line("."))
- let l:lineBuffer = l:lineBuffer . ' ' . l:line
- let l:count = l:count + 1
- endwhile
- " Function definition seem to be too long...
- if ( l:count == g:DoxygenToolkit_maxFunctionProtoLines )
- " Restore standard comment expension
- let &comments = l:oldComments
- " Restore indentation
- let &cinoptions = l:oldcinoptions
- return
- endif
- endif
-
- " Start creating doxygen pattern
- exec "normal `d"
- if ( g:DoxygenToolkit_blockHeader != "" )
- exec "normal O" . g:DoxygenToolkit_startCommentBlock . g:DoxygenToolkit_blockHeader . g:DoxygenToolkit_endCommentBlock
- exec "normal o" . g:DoxygenToolkit_startCommentTag . g:DoxygenToolkit_briefTag_pre
- else
- if ( g:DoxygenToolkit_commentType == "C++" )
- exec "normal O" . g:DoxygenToolkit_startCommentTag . g:DoxygenToolkit_briefTag_pre
- else
- exec "normal O" . g:DoxygenToolkit_startCommentTag
- exec "normal o" . g:DoxygenToolkit_interCommentTag . g:DoxygenToolkit_briefTag_pre
- endif
- endif
- mark d
- if ( g:DoxygenToolkit_endCommentTag != "" )
- exec "normal o" . g:DoxygenToolkit_endCommentTag
- endif
- if ( g:DoxygenToolkit_blockFooter != "" )
- exec "normal o" . g:DoxygenToolkit_startCommentBlock . g:DoxygenToolkit_blockFooter . g:DoxygenToolkit_endCommentBlock
- endif
- exec "normal `d"
-
- " Class definition, let's start with brief tag
- if ( l:classDef == 1 )
- " Restore standard comment expension
- let &comments = l:oldComments
- " Restore indentation
- let &cinoptions = l:oldcinoptions
-
- startinsert!
- return
- endif
-
- " Replace tabs by space
- let l:lineBuffer = substitute(l:lineBuffer, "\t", "\ ", "g")
-
- " Delete recursively all double spaces
- while ( match(l:lineBuffer, "\ \ ") != -1 )
- let l:lineBuffer = substitute(l:lineBuffer, "\ \ ", "\ ", "g")
- endwhile
-
- " Delete space just after and just before parenthesis
- " Remove space between function name and opening paenthesis
- let l:lineBuffer = substitute(l:lineBuffer, "(\ ", "(", "")
- let l:lineBuffer = substitute(l:lineBuffer, "\ )", ")", "")
- let l:lineBuffer = substitute(l:lineBuffer, "\ (", "(", "")
-
- " Delete first space (if any)
- if ( match(l:lineBuffer, ' ') == 0 )
- let l:lineBuffer = strpart(l:lineBuffer, 1)
- endif
-
- " Add function name if requiered
- if ( g:DoxygenToolkit_briefTag_funcName =~ "yes" )
- let l:beginP = 0
- let l:currentP = -1
- let l:endP = match( l:lineBuffer, l:argBegin )
- while ( l:currentP < l:endP )
- let l:beginP = l:currentP + 1
- let l:currentP = match( l:lineBuffer, '[&*[:space:]]', l:beginP )
- if ( l:currentP == -1 )
- let l:currentP = l:endP
- endif
- endwhile
- let l:name = strpart( l:lineBuffer, l:beginP, l:endP - l:beginP )
- exec "normal A" . l:name
- endif
-
- " Now can add brief post tag
- exec "normal A" . g:DoxygenToolkit_briefTag_post
-
- " Add return tag if function do not return void
- let l:beginArgPos = match(l:lineBuffer, l:argBegin)
- let l:beginP = 0 " Name can start at the beginning of l:lineBuffer, it is usually between whitespaces or space and parenthesis
- let l:endP = 0
- let l:returnFlag = -1 " At least one name (function name) do not correspond to the list of ignored values.
- while ( l:endP != l:beginArgPos )
- " look for * or & (pointer or reference)
- let l:endP = match(l:lineBuffer, '[&*]', l:beginP )
- if ( l:endP > l:beginArgPos || l:endP == -1 )
- " not found --> look for whitespace
- let l:endP = match(l:lineBuffer, '\s', l:beginP )
- if ( l:endP > l:beginArgPos || l:endP == -1 )
- let l:endP = l:beginArgPos
- endif
- else
- " found * or & -- so we have a return value
- let l:returnFlag = l:returnFlag + 1
- endif
- let l:name = strpart(l:lineBuffer, l:beginP, l:endP - l:beginP)
- let l:beginP = l:endP + 1
- " Hack, because of '~' is not correctly interprated by match... if you
- " have a solution, send me it !
- if ( l:name[0] != '~' && matchstr(g:DoxygenToolkit_ignoreForReturn, "\\<" . l:name . "\\>") != l:name )
- let l:returnFlag = l:returnFlag + 1
- endif
- endwhile
- if ( l:returnFlag >= 1 )
- exec "normal o" . g:DoxygenToolkit_interCommentTag
- exec "normal o" . g:DoxygenToolkit_interCommentTag . g:DoxygenToolkit_returnTag
- endif
-
- " Looking for argument name in line buffer
- exec "normal `d"
- let l:argList = 0 " ==0 -> no argument, !=0 -> at least one arg
-
- let l:beginP = 0
- let l:endP = 0
- let l:prevBeginP = 0
-
- " Arguments start after opening parenthesis
- let l:beginP = match(l:lineBuffer, l:argBegin, l:beginP) + 1
- let l:prevBeginP = l:beginP
- let l:endP = l:beginP
-
- " Test if there is something into parenthesis
- let l:beginP = l:beginP
- if ( l:beginP == match(l:lineBuffer, l:argEnd, l:beginP) )
- " Restore standard comment expension
- let &comments = l:oldComments
- " Restore indentation
- let &cinoptions = l:oldcinoptions
-
- startinsert!
- return
- endif
-
- " Enter into main loop
- while ( l:beginP > 0 && l:endP > 0 )
-
- " Looking for arg separator
- let l:endP1 = match(l:lineBuffer, l:argSep, l:beginP)
- let l:endP = match(l:lineBuffer, l:argEnd, l:beginP)
- if ( l:endP1 != -1 && l:endP1 < l:endP )
- let l:endP = l:endP1
- endif
- let l:endP = l:endP - 1
-
- if ( l:endP > 0 )
- let l:strBuf = ReturnArgName(l:lineBuffer, l:beginP, l:endP)
- " void parameter
- if ( l:strBuf == l:voidStr )
- " Restore standard comment expension
- let &comments = l:oldComments
- " Restore indentation
- let &cinoptions = l:oldcinoptions
-
- startinsert!
- break
- endif
- exec "normal o" . g:DoxygenToolkit_interCommentTag . g:DoxygenToolkit_paramTag_pre . l:strBuf . g:DoxygenToolkit_paramTag_post
- let l:beginP = l:endP + 2
- let l:argList = 1
- endif
- endwhile
-
- " Add blank line if necessary
- if ( l:argList != 0 )
- exec "normal `do" . g:DoxygenToolkit_interCommentTag
- endif
-
- " move the cursor to the correct position (after brief tag)
- exec "normal `d"
-
- " Restore standard comment expension
- let &comments = l:oldComments
- " Restore indentation
- let &cinoptions = l:oldcinoptions
-
- startinsert!
-endfunction
+" PYTHON specific
+"""""""""""""""""
+" Remove automatically self parameter from function to avoid its documantation
+if !exists("g:DoxygenToolkit_python_autoRemoveSelfParam")
+ let g:DoxygenToolkit_python_autoRemoveSelfParam = "yes"
+endif
+" Consider functions as if they always return something (default: yes)
+if !exists("g:DoxygenToolkit_python_autoFunctionReturn")
+ let g:DoxygenToolkit_python_autoFunctionReturn = "yes"
+endif
""""""""""""""""""""""""""
" Doxygen license comment
""""""""""""""""""""""""""
function! <SID>DoxygenLicenseFunc()
- " Store indentation
- let l:oldcinoptions = &cinoptions
- " Set new indentation
- let &cinoptions=g:DoxygenToolkit_cinoptions
-
- " Test authorName variable
- if !exists("g:DoxygenToolkit_authorName")
- let g:DoxygenToolkit_authorName = input("Enter name of the author (generally yours...) : ")
- endif
- mark d
- let l:date = strftime("%Y")
- exec "normal O/*\<Enter>" . g:DoxygenToolkit_licenseTag
- exec "normal ^c$*/"
- if ( g:DoxygenToolkit_licenseTag == s:licenseTag )
- exec "normal %jA" . l:date . " - " . g:DoxygenToolkit_authorName
- endif
- exec "normal `d"
-
- " Restore indentation
- let &cinoptions = l:oldcinoptions
+ call s:InitializeParameters()
+
+ " Test authorName variable
+ if !exists("g:DoxygenToolkit_authorName")
+ let g:DoxygenToolkit_authorName = input("Enter name of the author (generally yours...) : ")
+ endif
+ mark d
+ let l:date = strftime("%Y")
+ exec "normal O".s:startCommentBlock.substitute( g:DoxygenToolkit_licenseTag, "\<enter>", "\<enter>".s:interCommentBlock, "g" )
+ if( s:endCommentBlock != "" )
+ exec "normal o".s:endCommentBlock
+ endif
+ if( g:DoxygenToolkit_licenseTag == s:licenseTag )
+ exec search("Copyright (C)", "beW")
+ exec "normal A".l:date." - ".g:DoxygenToolkit_authorName
+ endif
+ exec "normal `d"
+
+ call s:RestoreParameters()
endfunction
@@ -539,67 +409,63 @@ endfunction
" Doxygen author comment
""""""""""""""""""""""""""
function! <SID>DoxygenAuthorFunc()
- " Save standard comment expension
- let l:oldComments = &comments
- let &comments = ""
- " Store indentation
- let l:oldcinoptions = &cinoptions
- " Set new indentation
- let &cinoptions=g:DoxygenToolkit_cinoptions
-
- " Test authorName variable
- if !exists("g:DoxygenToolkit_authorName")
- let g:DoxygenToolkit_authorName = input("Enter name of the author (generally yours...) : ")
- endif
-
- " Get file name
- let l:fileName = expand('%:t')
-
- " Begin to write skeleton
- exec "normal O" . g:DoxygenToolkit_startCommentTag
- exec "normal o" . g:DoxygenToolkit_interCommentTag . g:DoxygenToolkit_fileTag . l:fileName
- exec "normal o" . g:DoxygenToolkit_interCommentTag . g:DoxygenToolkit_briefTag_pre
- mark d
- exec "normal o" . g:DoxygenToolkit_interCommentTag . g:DoxygenToolkit_authorTag . g:DoxygenToolkit_authorName
- let l:date = strftime("%Y-%m-%d")
- exec "normal o" . g:DoxygenToolkit_interCommentTag . g:DoxygenToolkit_dateTag . l:date
- if ( g:DoxygenToolkit_endCommentTag == "" )
- exec "normal o" . g:DoxygenToolkit_interCommentTag
- else
- exec "normal o" . g:DoxygenToolkit_endCommentTag
- endif
-
- " Replace the cursor to the rigth position
- exec "normal `d"
-
- " Restore standard comment expension
- let &comments = l:oldComments
- " Restore indentation
- let &cinoptions = l:oldcinoptions
- startinsert!
+ call s:InitializeParameters()
+
+ " Test authorName variable
+ if !exists("g:DoxygenToolkit_authorName")
+ let g:DoxygenToolkit_authorName = input("Enter name of the author (generally yours...) : ")
+ endif
+
+ " Test versionString variable
+ if !exists("g:DoxygenToolkit_versionString")
+ let g:DoxygenToolkit_versionString = input("Enter version string : ")
+ endif
+
+ " Get file name
+ let l:fileName = expand('%:t')
+
+ " Begin to write skeleton
+ let l:insertionMode = s:StartDocumentationBlock()
+ exec "normal ".l:insertionMode.s:interCommentTag.g:DoxygenToolkit_fileTag.l:fileName
+ exec "normal o".s:interCommentTag.g:DoxygenToolkit_briefTag_pre
+ mark d
+ exec "normal o".s:interCommentTag.g:DoxygenToolkit_authorTag.g:DoxygenToolkit_authorName
+ exec "normal o".s:interCommentTag.g:DoxygenToolkit_versionTag.g:DoxygenToolkit_versionString
+ let l:date = strftime("%Y-%m-%d")
+ exec "normal o".s:interCommentTag.g:DoxygenToolkit_dateTag.l:date
+ if ( g:DoxygenToolkit_endCommentTag != "" )
+ exec "normal o".s:endCommentTag
+ endif
+
+ " Move the cursor to the rigth position
+ exec "normal `d"
+
+ call s:RestoreParameters()
+ startinsert!
endfunction
""""""""""""""""""""""""""
" Doxygen undocument function
+" C/C++ only!
""""""""""""""""""""""""""
function! <SID>DoxygenUndocumentFunc(blockTag)
- let l:search = "#ifdef " . a:blockTag
- " Save cursor position and go to the begining of the file
- mark d
- exec "normal gg"
-
- while ( search(l:search, 'W') != 0 )
- exec "normal O#ifndef " . g:DoxygenToolkit_undocTag
- exec "normal j^%"
- if ( g:DoxygenToolkit_endCommentTag == "" )
- exec "normal o#endif // " . g:DoxygenToolkit_undocTag
- else
- exec "normal o#endif /* " . g:DoxygenToolkit_undocTag . " */"
- endif
- endwhile
-
- exec "normal `d"
+ let l:search = "#ifdef " . a:blockTag
+ " Save cursor position and go to the begining of the file
+ mark d
+ exec "normal gg"
+
+ while ( search(l:search, 'W') != 0 )
+ exec "normal O#ifndef " . g:DoxygenToolkit_undocTag
+ exec "normal j^%"
+ if ( g:DoxygenToolkit_endCommentTag == "" )
+ exec "normal o#endif // " . g:DoxygenToolkit_undocTag
+ else
+ exec "normal o#endif /* " . g:DoxygenToolkit_undocTag . " */"
+ endif
+ endwhile
+
+ exec "normal `d"
endfunction
@@ -608,108 +474,515 @@ endfunction
" DoxygenBlockFunc
""""""""""""""""""""""""""
function! <SID>DoxygenBlockFunc()
- " Save standard comment expension
- let l:oldComments = &comments
- let &comments = ""
- " Store indentation
- let l:oldcinoptions = &cinoptions
- " Set new indentation
- let &cinoptions=g:DoxygenToolkit_cinoptions
-
- exec "normal o" . g:DoxygenToolkit_startCommentTag
- exec "normal o" . g:DoxygenToolkit_interCommentTag . g:DoxygenToolkit_blockTag
- mark d
- exec "normal o" . g:DoxygenToolkit_interCommentTag . "@{ " . g:DoxygenToolkit_endCommentTag
- exec "normal o" . g:DoxygenToolkit_startCommentTag . " @} " . g:DoxygenToolkit_endCommentTag
- exec "normal `d"
-
- " Restore standard comment expension
- let &comments = l:oldComments
- " Restore indentation
- let &cinoptions = l:oldcinoptions
- startinsert!
+ call s:InitializeParameters()
+
+ let l:insertionMode = s:StartDocumentationBlock()
+ exec "normal ".l:insertionMode.s:interCommentTag.g:DoxygenToolkit_blockTag
+ mark d
+ exec "normal o".s:interCommentTag."@{ ".s:endCommentTag
+ exec "normal o".s:startCommentTag." @} ".s:endCommentTag
+ exec "normal `d"
+
+ call s:RestoreParameters()
+ startinsert!
endfunction
-"function! AppendText(text)
-" call append(line("."), a:text)
-" exec "normal j"
-"endfunction
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Main comment function for class, attribute, function...
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+function! <SID>DoxygenCommentFunc()
+ " Initialize default templates.
+ " Assure compatibility with Python for classes (cf. endDocPattern).
+ let l:emptyLinePattern = '^[[:blank:]]*$'
+ let l:someNamePattern = '[_[:alpha:]][_[:alnum:]]*'
+
+ if( s:CheckFileType() == "cpp" )
+ let l:someNameWithNamespacePattern = l:someNamePattern.'\%(::'.l:someNamePattern.'\)*'
+ let l:endDocPattern = ';\|{\|\%([^:]\zs:\ze\%([^:]\|$\)\)'
+ let l:commentPattern = '\%(/*\)\|\%(//\)\'
+ let l:templateParameterPattern = "<[^<>]*>"
+
+ let l:classPattern = '\<class\>[[:blank:]]\+\zs'.l:someNameWithNamespacePattern.'\ze.*\%('.l:endDocPattern.'\)'
+ let l:structPattern = '\<struct\>[[:blank:]]\+\zs'.l:someNameWithNamespacePattern.'\ze.*\%('.l:endDocPattern.'\)'
+ let l:enumPattern = '\<enum\>\%(\%([[:blank:]]\+\zs'.l:someNamePattern.'\ze[[:blank:]]*\)\|\%(\zs\ze[[:blank:]]*\)\)\%('.l:endDocPattern.'\)'
+ let l:namespacePattern = '\<namespace\>[[:blank:]]\+\zs'.l:someNamePattern.'\ze[[:blank:]]*\%('.l:endDocPattern.'\)'
+
+ let l:types = { "class": l:classPattern, "struct": l:structPattern, "enum": l:enumPattern, "namespace": l:namespacePattern }
+ else
+ let l:commentPattern = '#\|^[[:blank:]]*"""'
+
+ let l:classPattern = '\<class\>[[:blank:]]\+\zs'.l:someNamePattern.'\ze.*:'
+ let l:functionPattern = '\<def\>[[:blank:]]\+\zs'.l:someNamePattern.'\ze.*:'
+
+ let l:endDocPattern = '\%(\<class\>\|\<def\>[^:]*\)\@<!$'
+
+ let l:types = { "class": l:classPattern, "function": l:functionPattern }
+ endif
+
+ let l:lineBuffer = getline( line( "." ) )
+ let l:count = 1
+ let l:endDocFound = 0
+
+ let l:doc = { "type": "", "name": "None", "params": [], "returns": "" }
+
+ " Mark current line for future use
+ mark d
+
+ " Look for function/method/... to document
+ " We look only on the first three lines!
+ while( match( l:lineBuffer, l:emptyLinePattern ) != -1 && l:count < 4 )
+ exec "normal j"
+ let l:lineBuffer = l:lineBuffer.' '.getline( line( "." ) )
+ let l:count = l:count + 1
+ endwhile
+ " Error message when the buffer is still empty.
+ if( match( l:lineBuffer, l:emptyLinePattern ) != -1 )
+ call s:WarnMsg( "Nothing to document here!" )
+ exec "normal `d"
+ return
+ endif
+
+ " Remove unwanted lines (ie: jump to the first significant line)
+ if( g:DoxygenToolkit_keepEmptyLineAfterComment == "no" )
+ " This erase previous mark
+ mark d
+ endif
+
+ " Look for the end of the function/class/... to document
+ " TODO does not work when function/class/... is commented out!
+ let l:count = 0
+ while( l:endDocFound == 0 && l:count < g:DoxygenToolkit_maxFunctionProtoLines )
+ let l:lineBuffer = s:RemoveComments( l:lineBuffer )
+ " Valid only for cpp. For Python it must be 'class ...:' or 'def ...:' or
+ " '... EOL'.
+ if( match( l:lineBuffer, l:endDocPattern ) != -1 )
+ let l:endDocFound = 1
+ continue
+ endif
+ exec "normal j"
+ let l:lineBuffer = l:lineBuffer.' '.getline( line( "." ))
+ let l:count = l:count + 1
+ endwhile
+ " Error message when the end of the function(/...) has not been found
+ if( l:endDocFound == 0 )
+ if( match( l:lineBuffer, l:emptyLinePattern ) != -1 )
+ " Fall here when only comments have been found.
+ call s:WarnMsg( "Nothing to document here!" )
+ exec "normal `d"
+ return
+ else
+ call s:WarnMsg( "Cannot reach end of function/class/... declaration!" )
+ exec "normal `d"
+ return
+ endif
+ endif
+
+ " Trim the buffer
+ let l:lineBuffer = substitute( l:lineBuffer, "^[[:blank:]]*\|[[:blank:]]$", "", "g" )
+
+ " Remove any template parameter.
+ if( s:CheckFileType() == "cpp" )
+ while( match( l:lineBuffer, l:templateParameterPattern ) != -1 )
+ let l:lineBuffer = substitute( l:lineBuffer, l:templateParameterPattern, "", "g" )
+ endwhile
+ endif
+
+ " Look for the type
+ for key in keys( l:types )
+ "call s:WarnMsg( "[DEBUG] buffer:_".l:lineBuffer."_, test:_".l:types[key] )
+ let l:name = matchstr( l:lineBuffer, l:types[key] )
+ if( l:name != "" )
+ let l:doc.type = key
+ let l:doc.name = l:name
+
+ " Python only. Functions are detected differently for C/C++.
+ if( key == "function" )
+ "call s:WarnMsg( "HERE !!!".l:lineBuffer )
+ call s:ParseFunctionParameters( l:lineBuffer, l:doc )
+ endif
+ break
+ endif
+ endfor
+
+ if( l:doc.type == "" )
+ " Should be a function/method (cpp only) or an attribute.
+ " (cpp only) Can also be an unnamed enum/namespace... (or something else ?)
+ if( s:CheckFileType() == "cpp" )
+ if( match( l:lineBuffer, '(' ) == -1 )
+ if( match( l:lineBuffer, '\<enum\>' ) != -1 )
+ let l:doc.type = 'enum'
+ elseif( match( l:lineBuffer, '\<namespace\>' ) != -1 )
+ let l:doc.type = 'namespace'
+ else
+ " TODO here we get a class attribute of something like that.
+ " We probably just need a \brief statement...
+ let l:doc.type = 'attribute'
+ " TODO Retrieve the name of the attribute.
+ " Do we really need it? I'm not sure for the moment.
+ endif
+ else
+ let l:doc.type = 'function'
+ call s:ParseFunctionParameters( l:lineBuffer, l:doc )
+ endif
+
+ " This is an attribute for Python
+ else
+ let l:doc.type = 'attribute'
+ endif
+ endif
+
+ " Remove the function/class/... name when it is not necessary
+ if( ( key == "class" && g:DoxygenToolkit_briefTag_className != "yes" ) || ( key == "struct" && g:DoxygenToolkit_briefTag_structName != "yes" ) || ( key == "enum" && g:DoxygenToolkit_briefTag_enumName != "yes" ) || ( key == "namespace" && g:DoxygenToolkit_briefTag_namespaceName != "yes" ) || ( l:doc.type == "function" && g:DoxygenToolkit_briefTag_funcName != "yes" ) )
+ let l:doc.name = "None"
+
+ " Remove namespace from the name of the class/function...
+ elseif( s:CheckFileType() == "cpp" )
+ let l:doc.name = substitute( l:doc.name, '\%('.l:someNamePattern.'::\)', '', 'g' )
+ endif
+
+ " Below, write what we have found
+ """""""""""""""""""""""""""""""""
+
+ call s:InitializeParameters()
+ if( s:CheckFileType() == "python" && l:doc.type == "function" && g:DoxygenToolkit_python_autoFunctionReturn == "yes" )
+ let l:doc.returns = "yes"
+ endif
+
+ " Header
+ exec "normal `d"
+ if( g:DoxygenToolkit_blockHeader != "" )
+ exec "normal O".s:startCommentBlock.g:DoxygenToolkit_blockHeader.s:endCommentBlock
+ exec "normal `d"
+ endif
+
+ " Brief
+ if( g:DoxygenToolkit_compactOneLineDoc =~ "yes" && l:doc.returns != "yes" && len( l:doc.params ) == 0 )
+ let s:compactOneLineDoc = "yes"
+ exec "normal O".s:startCommentTag.g:DoxygenToolkit_briefTag_pre.g:DoxygenToolkit_briefTag_post
+ else
+ let s:compactOneLineDoc = "no"
+ let l:insertionMode = s:StartDocumentationBlock()
+ exec "normal ".l:insertionMode.s:interCommentTag.g:DoxygenToolkit_briefTag_pre.g:DoxygenToolkit_briefTag_post
+ endif
+ if( l:doc.name != "None" )
+ exec "normal A".l:doc.name." "
+ endif
+
+ " Mark the line where the cursor will be positionned.
+ mark d
+
+ " Arguments/parameters
+ if( g:DoxygenToolkit_compactDoc =~ "yes" )
+ let s:insertEmptyLine = 0
+ else
+ let s:insertEmptyLine = 1
+ endif
+ for param in l:doc.params
+ if( s:insertEmptyLine == 1 )
+ exec "normal o".s:interCommentTag
+ let s:insertEmptyLine = 0
+ endif
+ exec "normal o".s:interCommentTag.g:DoxygenToolkit_paramTag_pre.g:DoxygenToolkit_paramTag_post.param
+ endfor
+
+ " Returned value
+ if( l:doc.returns == "yes" )
+ if( g:DoxygenToolkit_compactDoc != "yes" )
+ exec "normal o".s:interCommentTag
+ endif
+ exec "normal o".s:interCommentTag.g:DoxygenToolkit_returnTag
+ endif
+
+ " End (if any) of documentation block.
+ if( s:endCommentTag != "" )
+ if( s:compactOneLineDoc =~ "yes" )
+ let s:execCommand = "A "
+ else
+ let s:execCommand = "o"
+ endif
+ exec "normal ".s:execCommand.s:endCommentTag
+ endif
+
+ " Footer
+ if ( g:DoxygenToolkit_blockFooter != "" )
+ exec "normal o".s:startCommentBlock.g:DoxygenToolkit_blockFooter.s:endCommentBlock
+ endif
+ exec "normal `d"
+
+ call s:RestoreParameters()
+ startinsert!
+
+ " DEBUG purpose only
+ "call s:WarnMsg( "Found a ".l:doc.type." named ".l:doc.name." (env: ".s:CheckFileType().")." )
+ "if( l:doc.type == "function" )
+ " let l:funcReturn = "returns something."
+ " if( l:doc.returns == "" )
+ " let l:funcReturn = "doesn't return anything."
+ " endif
+ " call s:WarnMsg( " - which ".l:funcReturn )
+ " call s:WarnMsg( " - which has following parameter(s):" )
+ " for param in l:doc.params
+ " call s:WarnMsg( " - ".param )
+ " endfor
+ "endif
+
+endfunction
+
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Write the beginning of the documentation block:
+" - C and Python format: insert '/**' and '##' respectively then a linefeed,
+" - C++ insert '///' and continue on the same line
"
-" Returns the indentations level for a line
-" MakeIndent([lineNum])
-"
-"function! MakeIndent(...)
-" let line = getline(".")
-" if a:0 == 1
-" let line = getline(a:1)
-" endif
-" return matchstr(line, '^\s*')
-"endfunction
+" This function return the insertion mode which should be used for the next
+" call to 'normal'.
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+function! s:StartDocumentationBlock()
+ " For C++ documentation format we do not need first empty line
+ if( s:startCommentTag != s:interCommentTag )
+ exec "normal O".s:startCommentTag
+ let l:insertionMode = "o"
+ else
+ let l:insertionMode = "O"
+ endif
+ return l:insertionMode
+endfunction
-""""""""""""""""""""""""""
-" Extract the name of argument
-""""""""""""""""""""""""""
-function ReturnArgName(argBuf, beginP, endP)
-
- " Name of argument is at the end of argBuf if no default (id arg = 0)
- let l:equalP = match(a:argBuf, "=", a:beginP)
- if ( l:equalP == -1 || l:equalP > a:endP )
- " Look for arg name begining
- let l:beginP = a:beginP
- let l:prevBeginP = l:beginP
- while ( l:beginP < a:endP && l:beginP != -1 )
- let l:prevBeginP = l:beginP
- let l:beginP = match(a:argBuf, " ", l:beginP + 1)
- endwhile
- let l:beginP = l:prevBeginP
- let l:endP = a:endP
- else
- " Look for arg name begining
- let l:addPos = 0
- let l:beginP = a:beginP
- let l:prevBeginP = l:beginP
- let l:doublePrevBeginP = l:prevBeginP
- while ( l:beginP < l:equalP && l:beginP != -1 )
- let l:doublePrevBeginP = l:prevBeginP
- let l:prevBeginP = l:beginP + l:addPos
- let l:beginP = match(a:argBuf, " ", l:beginP + 1)
- let l:addPos = 1
- endwhile
-
- " Space just before equal
- if ( l:prevBeginP == l:equalP )
- let l:beginP = l:doublePrevBeginP
- let l:endP = l:prevBeginP - 2
- else
- " No space just before so...
- let l:beginP = l:prevBeginP
- let l:endP = l:equalP - 1
- endif
- endif
-
- " We have the begining position and the ending position...
- let l:newBuf = strpart(a:argBuf, l:beginP, l:endP - l:beginP + 1)
-
- " Delete leading '*' or '&'
- if ( match(l:newBuf, "*") == 1 || match(l:newBuf, "&") == 1 )
- let l:newBuf = strpart(l:newBuf, 2)
- endif
-
- " Delete tab definition ([])
- let l:delTab = match(newBuf, "[")
- if ( l:delTab != -1 )
- let l:newBuf = strpart(l:newBuf, 0, l:delTab)
- endif
-
- " Eventually clean argument name...
- let l:newBuf = substitute(l:newBuf, " ", "", "g")
- return l:newBuf
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Remove comments from the given buffer.
+" - Remove everything after '//' or '#'.
+" - Remove everything between '/*' and '*/' or keep '/*' if '*/' is not present.
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+function! s:RemoveComments( lineBuffer )
+ if( s:CheckFileType() == "cpp" )
+ " Remove C++ (//) comment.
+ let l:lineBuffer = substitute( a:lineBuffer, '[[:blank:]]*\/\/.*$', '', '')
+ " Remove partial C (/* ...) comment: /* foo bar --> /*
+ " '/*' is preserved until corresponding '*/' is found. Other part of the
+ " comment is discarded to prevent the case where it contains characters
+ " corresponding to the endDoc string.
+ let l:lineBuffer = substitute( l:lineBuffer, '\%(\/\*\zs.*\ze\)\&\%(\%(\/\*.*\*\/\)\@!\)', '', '')
+ " Remove C (/* ... */) comment.
+ let l:lineBuffer = substitute( l:lineBuffer, '\/\*.\{-}\*\/', '', 'g')
+ else
+ let l:lineBuffer = substitute( a:lineBuffer, '[[:blank:]]*#.*$', '', '')
+ endif
+ return l:lineBuffer
endfunction
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Retrieve file type.
+" - Default type is still 'cpp'.
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+function! s:CheckFileType()
+ if( &filetype == "python" )
+ let l:fileType = "python"
+ else
+ let l:fileType = "cpp"
+ endif
+ return l:fileType
+endfunction
+
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Parse the buffer and set the doc parameter.
+" - Functions which return pointer to function are not supported.
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+function! s:ParseFunctionParameters( lineBuffer, doc )
+ " call s:WarnMsg( 'IN__'.a:lineBuffer )
+ let l:paramPosition = matchend( a:lineBuffer, 'operator[[:blank:]]*([[:blank:]]*)' )
+ if ( l:paramPosition == -1 )
+ let l:paramPosition = stridx( a:lineBuffer, '(' )
+ else
+ let l:paramPosition = stridx( a:lineBuffer, '(', l:paramPosition )
+ endif
+
+
+ " (cpp only) First deal with function name and returned value.
+ " Function name has alredy been retrieved for Python and we need to parse
+ " all the function definition to know whether a value is returned or not.
+ if( s:CheckFileType() == "cpp" )
+ let l:functionBuffer = strpart( a:lineBuffer, 0, l:paramPosition )
+ for ignored in g:DoxygenToolkit_ignoreForReturn
+ let l:functionBuffer = substitute( l:functionBuffer, '\<'.ignored.'\>', '', 'g' )
+ endfor
+ let l:functionReturnAndName = split( l:functionBuffer, '[[:blank:]*]' )
+ if( len( l:functionReturnAndName ) > 1 )
+ let a:doc.returns = 'yes'
+ endif
+ let a:doc.name = l:functionReturnAndName[-1]
+ endif
+
+ " Work on parameters.
+ let l:parametersBuffer = strpart( a:lineBuffer, l:paramPosition + 1 )
+ " Remove trailing closing bracket and everything that follows and trim.
+ if( s:CheckFileType() == "cpp" )
+ let l:parametersBuffer = substitute( l:parametersBuffer, ')[^)]*\%(;\|{\|\%([^:]:\%([^:]\|$\)\)\).*', '', '' )
+ else
+ let l:parametersBuffer = substitute( l:parametersBuffer, ')[^)]*:.*', '', '' )
+ endif
+ let l:parametersBuffer = substitute( l:parametersBuffer, '^[[:blank:]]*\|[[:blank:]]*$', '', '' )
+
+ " Remove default parameter values (if any).
+ let l:index = stridx( l:parametersBuffer, '=' )
+ let l:startIndex = l:index
+ while( l:index != -1 )
+ " Look for the next colon...
+ let l:colonIndex = stridx( l:parametersBuffer, ',', l:startIndex )
+ if( l:colonIndex == -1 )
+ let l:colonIndex = strlen( l:parametersBuffer )
+ endif
+ let l:paramBuffer = strpart( l:parametersBuffer, l:index, l:colonIndex - l:index )
+ if( s:CountBrackets( l:paramBuffer ) == 0 )
+ " Everything in [l:index, l:colonIndex[ can be removed.
+ let l:parametersBuffer = substitute( l:parametersBuffer, l:paramBuffer, '', '' )
+ let l:index = stridx( l:parametersBuffer, '=' )
+ let l:startIndex = l:index
+ else
+ " Parameter initialization contains brakets and colons...
+ let l:startIndex = l:colonIndex + 1
+ endif
+ endwhile
+
+ "call s:WarnMsg( "[DEBUG]: ".l:parametersBuffer )
+ " Now, work on each parameter.
+ let l:params = []
+ let l:index = stridx( l:parametersBuffer, ',' )
+ while( l:index != -1 )
+ let l:paramBuffer = strpart( l:parametersBuffer, 0, l:index )
+ if( s:CountBrackets( l:paramBuffer ) == 0 )
+ let l:params = add( l:params, s:ParseParameter( l:paramBuffer ) )
+ let l:parametersBuffer = strpart( l:parametersBuffer, l:index + 1 )
+ let l:index = stridx( l:parametersBuffer, ',' )
+ else
+ let l:index = stridx( l:parametersBuffer, ',', l:index + 1 )
+ endif
+ endwhile
+ if( strlen( l:parametersBuffer ) != 0 )
+ let l:params = add( l:params, s:ParseParameter( l:parametersBuffer ) )
+ endif
+
+ if( s:CheckFileType() == "cpp" )
+ call filter( l:params, 'v:val !~ "void"' )
+ else
+ if( g:DoxygenToolkit_python_autoRemoveSelfParam == "yes" )
+ call filter( l:params, 'v:val !~ "self"' )
+ endif
+ endif
+
+ for param in l:params
+ call add( a:doc.params, param )
+ "call s:WarnMsg( '[DEBUG]:OUT_'.param )
+ endfor
+endfunction
+
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Parse given parameter and return its name.
+" It is easy to do unless you use function's pointers...
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+function! s:ParseParameter( param )
+ let l:paramName = "Unknown"
+ let l:firstIndex = stridx( a:param, '(' )
+
+ if( l:firstIndex == -1 )
+ let l:paramName = split( a:param, '[[:blank:]*]' )[-1]
+ else
+ if( l:firstIndex != 0 )
+ let l:startIndex = 0
+ else
+ let l:startIndex = stridx( a:param, ')' )
+ if( l:startIndex == -1 ) " Argggg...
+ let l:paramName = a:param
+ else
+ let l:startIndex += 1
+ while( s:CountBrackets( strpart( a:param, 0, l:startIndex ) ) != 0 )
+ let l:startIndex = stridx( a:param, ')', l:startIndex + 1 ) + 1
+ if( l:startIndex == -1) " Argggg...
+ let l:paramName = a:param
+ endif
+ endwhile
+ endif
+ endif
+
+ if( l:startIndex != -1 )
+ let l:startIndex = stridx( a:param, '(', l:startIndex ) + 1
+ let l:endIndex = stridx( a:param, ')', l:startIndex + 1 )
+ let l:param = strpart( a:param, l:startIndex, l:endIndex - l:startIndex )
+ let l:paramName = substitute( l:param, '^[[:blank:]*]*\|[[:blank:]*]*$', '', '' )
+ else
+ " Something really wrong has happened.
+ let l:paramName = a:param
+ endif
+ endif
+
+ return l:paramName
+endfunction
+
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Define start/end documentation format and backup generic parameters.
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+function! s:InitializeParameters()
+ if( s:CheckFileType() == "cpp" )
+ let s:startCommentTag = g:DoxygenToolkit_startCommentTag
+ let s:interCommentTag = g:DoxygenToolkit_interCommentTag
+ let s:endCommentTag = g:DoxygenToolkit_endCommentTag
+ let s:startCommentBlock = g:DoxygenToolkit_startCommentBlock
+ let s:interCommentBlock = g:DoxygenToolkit_interCommentBlock
+ let s:endCommentBlock = g:DoxygenToolkit_endCommentBlock
+ else
+ let s:startCommentTag = "## "
+ let s:interCommentTag = "# "
+ let s:endCommentTag = ""
+ let s:startCommentBlock = "# "
+ let s:interCommentBlock = "# "
+ let s:endCommentBlock = ""
+ endif
+
+ " Backup standard comment expension and indentation
+ let s:commentsBackup = &comments
+ let &comments = ""
+ let s:cinoptionsBackup = &cinoptions
+ let &cinoptions = g:DoxygenToolkit_cinoptions
+endfunction
+
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Restore previously backuped parameters.
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+function! s:RestoreParameters()
+ " Restore standard comment expension and indentation
+ let &comments = s:commentsBackup
+ let &cinoptions = s:cinoptionsBackup
+endfunction
+
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Count opened/closed brackets in the given buffer.
+" Each opened bracket increase the counter by 1.
+" Each closed bracket decrease the counter by 1.
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+function! s:CountBrackets( buffer )
+ let l:count = len( split( a:buffer, '(', 1 ) )
+ let l:count -= len( split( a:buffer, ')', 1 ) )
+ return l:count
+endfunction
+
+
+"""""""""""""""""""""""""""""""""""
+" Simple warning message function
+"""""""""""""""""""""""""""""""""""
+function! s:WarnMsg( msg )
+ echohl WarningMsg
+ echo a:msg
+ echohl None
+ return
+endfunction
""""""""""""""""""""""""""
" Shortcuts...
@@ -719,3 +992,4 @@ command! -nargs=0 DoxLic :call <SID>DoxygenLicenseFunc()
command! -nargs=0 DoxAuthor :call <SID>DoxygenAuthorFunc()
command! -nargs=1 DoxUndoc :call <SID>DoxygenUndocumentFunc(<q-args>)
command! -nargs=0 DoxBlock :call <SID>DoxygenBlockFunc()
+
--
vim-scripts packaging
More information about the pkg-vim-maintainers
mailing list