정리를 잘 해준 jimoom 군에게 special thanks..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
let s:Author = "David Noh" let s:Company = "kirknodeng.com" let s:Email = "kirknodeng@kirknodeng.com" let s:Organ = "CEO" autocmd BufNewFile *.v call VHeader() autocmd BufNewFile *.py call PyHeader() autocmd BufWrite *.v call VModifyTime() autocmd BufWrite *.py call PyModifyTime() command Als :call Als() command Cas :call Cas() function VHeader() let filename = expand("%") let modulename = matchstr(filename,'\w\+') let out = [] call add(out, '/*************************************************************************** ') call add(out, ' * This confidential and proprietary software may be used only ') call add(out, ' * as authorized by a licensing agreement from ' . s:Company . '. ') call add(out, ' * In the event of publication, the following notice is applicable: ') call add(out, ' * ') call add(out, ' * (C) COPYRIGHT ' .strftime("%Y") . ' ' . s:Company . '. ') call add(out, ' * ALL RIGHTS RESERVED ') call add(out, ' * ') call add(out, ' * The entire notice above must be reproduced on all authorized copies. ') call add(out, ' *************************************************************************** ') call add(out, ' * ') call add(out, ' * Filename : ' . filename ) call add(out, ' * Author : ' . s:Author . ' (' . s:Email . ')' ) call add(out, ' * Organiztion : ' . s:Company . '. ') call add(out, ' * ' . s:Organ . '. ') call add(out, ' * ') call add(out, ' * Description : ') call add(out, ' * ') call add(out, ' * Create : '.strftime("%b/%d/%Y/%H:%M").' ') call add(out, ' * Last Modified : ') call add(out, ' * ') call add(out, ' * Revision History ') call add(out, ' * '.strftime("%b/%d/%Y").' by ') call add(out, ' * ') call add(out, ' **************************************************************************/ ') call add(out, 'module ' .modulename. '(') call add(out, ');') call add(out, 'endmodule') call append(line(""),out) endfunction function PyHeader() let filename = expand("%") let out = [] call add(out, '#!/usr/bin/env python') call add(out, '#*************************************************************************** ') call add(out, '#* This confidential and proprietary software may be used only ') call add(out, '#* as authorized by a licensing agreement from ' . s:Company . '. ') call add(out, '#* In the event of publication, the following notice is applicable: ') call add(out, '#* ') call add(out, '#* (C) COPYRIGHT ' .strftime("%Y") . ' ' . s:Company . '. ') call add(out, '#* ALL RIGHTS RESERVED ') call add(out, '#* ') call add(out, '#* The entire notice above must be reproduced on all authorized copies. ') call add(out, '#*************************************************************************** ') call add(out, '#* ') call add(out, '#* Filename : ' . filename ) call add(out, '#* Author : ' . s:Author . ' (' . s:Email . ')' ) call add(out, '#* Organiztion : ' . s:Company . '. ') call add(out, '#* ' . s:Organ . '. ') call add(out, '#* ') call add(out, '#* Description : ') call add(out, '#* ') call add(out, '#* Create : '.strftime("%b/%d/%Y/%H:%M").' ') call add(out, '#* Last Modified : ') call add(out, '#* ') call add(out, '#* Revision History ') call add(out, '#* '.strftime("%b/%d/%Y").' by ') call add(out, '#* ') call add(out, '#*************************************************************************** ') call append(line(""),out) endfunction function VModifyTime() let cur_num = line(".") let cur_col = col(".") call search('Last Modified') let lnum = line(".") let line = getline(lnum) if line =~ '* Last Modified' call setline(lnum, ' * Last Modified : '.strftime("%b/%d/%Y/%H:%M").' by '.s:Author) endif call cursor(cur_num,cur_col) endfunction function PyModifyTime() let cur_num = line(".") let cur_col = col(".") call search('Last Modified') let lnum = line(".") let line = getline(lnum) if line =~ '* Last Modified' call setline(lnum, '#* Last Modified : '.strftime("%b/%d/%Y/%H:%M").' by '.s:Author) endif call cursor(cur_num,cur_col) endfunction function Als() let out = [] call add (out, 'always @(posedge `CLOCK or negedge `RESET ) begin') call add (out, ' if(~`RESET) <= ') call add (out, 'end') call append(line("."),out) endfunction function Cas() let out = [] call add (out, 'case ()') call add (out, ' default :') call add (out, 'endcase') call append(line("."),out) endfunction |