Doxygen style comments in vim for C ++

I would like to automate the insertion of comments for C ++ files. Suggested Google search c.vimplugin. I installed it. Now when I create the file, I get a template like the following.

 /* =====================================================================================
  *
  *       Filename:  Foo.h
  *
  *    Description:  :
  *
  *        Version:  1.0
  *        Created:  04/14/2014 08:35:44 PM
  *       Revision:  none
  *       Compiler:  gcc
  *
  *         Author:  YOUR NAME (), 
  *   Organization:  
  *
  * =====================================================================================
  */

From :h csupportI will catch, I can create my own templates for comments. Is there an easier way to get doxygen-style comments in a project? Or maybe these templates are available somewhere?

+4
source share
3 answers

, c.vim, , Snipmate Ultisnips. , .

+7

Doxygen vim. . : Dox, .

,

/**
 * @brief 
 *  
 * @param list 
 * @param size
 * @param key
 * @param rec
 *
 * @return 
 */
bool jw_search ( int *list, int size, int key, int& rec )
{
    return true;
}
+4

lh-cpp mu-template ( ). /c/internals/c -file-header.template - :

VimL: let s:filename = s:path_from_root(expand('%:p'))
VimL: let s:prj_dox_group = lh#option#get('my_prj_dox_group', lh#marker#txt('group'))
/**@file <+s:filename+>
 * @ingroup <+s:prj_dox_group+>
 * @author  <+Author()+>
 * <p>Licence:<p> Your Project Licence
 */

( : , foo.h foo.c(pp))

local_vimrc-like :

" File: /root/path/of/the/project/_vimrc_local.vim
:let b:my_prj_dox_group = "gMain" " you can override it in subfolders
:let b:sources_root = '/root/path/of/the/project' " for mu-template
:let b:includes = [b:sources_root . '/**'] " I can't remember which ftplugin uses b:includes
:let b:included_paths = [b:sources_root] " for ftplugin/c/c_AddInclude.vim
:let g:alternateSearchPath = 'sfr:.' " (or equivalent) for a.vim and for foo.cpp to include foo.h

BTW, lh-cpp :DOX, , doxygen ( @param [in/out/0], @return, @ingroup, @throw (noexcept ),... )

, :

/**
 * «brief explanation».
 * «details»
 * @param[«in,»out] list  «list-explanations»
 * @param[in] size  «size-explanations»
 * @param[in] key  «key-explanations»
 * @param[«in,»out] rec  «rec-explanations»
 *
 * @return «bool»
 * «@throw »
 * @pre <tt>list != NULL</tt>«»
 */
bool jw_search ( int* list, int size, int key, int& rec )

NB: «»

PS: , , c.vim, .

+1

Source: https://habr.com/ru/post/1536481/


All Articles