ohmkara 1.0

a technical blog.

comment boxes — verilog in vim

leave a comment »

I have recently started learning verilog (used to use vhdl) and using vim as the editor of choice. I wanted some easy way to insert verilog comment boxes in file — something like…

///////////////////////////////////////////////
// Author: Deepak (18/03/2009 21:22)
// Module: xxxxx.v
// Project: yyyyy
// Description: some random module.
//
///////////////////////////////////////////////

I added an abbreviation, as follows, in the .vimrc file…

:iab #b ///////////////////////////////////////////////<CR> Author: Deepak (<C-R>=strftime(“%d/%m/%Y %H:%M”)<CR>) <CR>Module: .v <CR>Project: <CR>Description: <CR><CR><BS>/////////////////////////////////////////////

Typing #b does the trick. What this gives me is (in case you are not Neo – the one) is the following ‘template’.

///////////////////////////////////////////////
// Author: Deepak (18/03/2009 21:22)
// Module: .v
// Project:
// Description:
//
///////////////////////////////////////////////

There are other ways to do this, like adding a macro as shown here — link, or with boxes. But I felt that typing on in insert mode is less intrusive.

Advertisements

Written by deepak

March 19, 2009 at 10:41 pm

Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: