newheader.vim


Ⅰ. 插件描述

Create function header comment according to a template

Ⅱ. 基本信息

创建日期:  2004-03-17
使用用户:  1
Github星:  1
插件作者:  erik janssen

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin '/newheader-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle '/newheader-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug '/newheader-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/vim-scripts/newheader.vim

Ⅳ. 文档说明

Just Another headerformatting script for C/C++. This one does not create headers conform some documenting standard but allows you to specify a template. The template may contain some keywords which are expanded. Start by pressing F7 while the cursor is on or a little above the function in question. If the script finds existing comments just above the function it will neatly format it into the template if the right keyword is found. Example (looking horrible in proportional fonts):

" Example _c_header template file:
" ==============================

" /
"  *
"  * NAME:        name                                    (date)
"  *
"  * DESCRIPTION: text
"  *
"  * ARGUMENTS:   args
"  *
"  * RETURNS:     -
"  *
"  * PRE:         -
"  *
"  * POST:        -
"  */
"

" Suppose you have this function:
" ===============================

" /*
"  * This is just a comment that is long enough to show the features of
"  * newheader.vim. It will do some indenting for you and list your function
"  * arguments
"  */
"
" static void show_header( int width, int length,
"                          byte font, Language *language_selection,
"                      byte color )
" {
"      ....
" }

" Result
" ======

" Place the cursor one or more lines before the function and press F7. It
" gives you:
"
" /
"  *
"  * NAME:        show_header                                    (2000 okt 27)
"  *
"  * DESCRIPTION: This is just a comment that is long enough to show the
"  *              features of newheader.vim. It will do some indenting for you
"  *              and list your function arguments
"  *
"  * ARGUMENTS:   width:
"  *              length:
"  *              font:
"                language_selection:
"  *              color:
"  *
"  * RETURNS:     -
"  *
"  * PRE:         -
"  *
"  * POST:        -
"  /
"
" static void show_header( int width, int length,
"                          byte font, Language *language_selection,
"                      byte color )
" {
"      ....
" }

disclaimer:
I'm using it a few years now, and it is a big timesaver. However, every new project requires me to do another generalisation on the script. If you think it may be usefull for you but produces odd results, drop me line.

添加新评论