Tip #141: Add your function heading with a keystroke
tip karma |
Rating 78/29, Viewed by 2290
|
created: |
|
October 18, 2001 22:36 |
|
complexity: |
|
basic |
author: |
|
Mohit Kalra [email protected] |
|
as of Vim: |
|
5.7 |
Below is a tip that the C/C++ Newbies may find interesting and handy to use. The following code will add a function heading and position your cursor just after Description so that one can document as one proceeds with code.
function FileHeading()
let s:line=line(".")
call setline(s:line,"/***************************************************")
call append(s:line,"* Description - ")
call append(s:line+1,"* Author - Mohit Kalra")
call append(s:line+2,"* Date - ".strftime("%b %d %Y"))
call append(s:line+3,"* *************************************************/")
unlet s:line
endfunction
imap <F4> <esc>mz:execute FileHeading()<RET>`zjA
Where <esc> stands for ^V+ESC and <RET> for ^V+ENTER
<<tip using embedded perl interpreter |
Automatic function end commenting for C++ and Java >>
Additional Notes
|