diff --git a/vim/templates/c_header_notice b/vim/templates/c_header_notice index bbe9087..6988711 100644 --- a/vim/templates/c_header_notice +++ b/vim/templates/c_header_notice @@ -1,6 +1,7 @@ /*======================================================================================= File: Creation Date: + Last Modified: Creator: Michael Campagnaro Notice: (C) Copyright $year by Jelly Pixel, Inc. All Rights Reserved. =======================================================================================*/ diff --git a/vimrc b/vimrc index 8138531..6ff08ba 100644 --- a/vimrc +++ b/vimrc @@ -318,9 +318,18 @@ augroup campoCmds " C/C++ template autocmd bufnewfile *.{c,cc,cpp,h,hpp} 0r ~/.vim/templates/c_header_notice - autocmd bufnewfile *.{c,cc,cpp,h,hpp} exe "2," . 6 . "g/File:.*/s//File: " .expand("%") - autocmd bufnewfile *.{c,cc,cpp,h,hpp} exe "2," . 6 . "g/Creation Date:.*/s//Creation Date: " .strftime("%Y-%m-%d") - autocmd bufnewfile *.{c,cc,cpp,h,hpp} exe "2," . 6 . "g/$year/s//" .strftime("%Y") + autocmd bufnewfile *.{c,cc,cpp,h,hpp} exe "2," . 7 . "g/File:.*/s//File: " .expand("%") + autocmd bufnewfile *.{c,cc,cpp,h,hpp} exe "2," . 7 . "g/Creation Date:.*/s//Creation Date: " .strftime("%Y-%m-%d") + autocmd bufnewfile *.{c,cc,cpp,h,hpp} exe "2," . 7 . "g/$year/s//" .strftime("%Y") + function! s:InsertModifiedDateIfRequired() + if &modified + normal! m0 + execute "2," . 7 . "g/Last Modified:.*/s//Last Modified: " .strftime("%Y-%m-%d %T") + normal! '0 + endif + endfunction + autocmd Bufwritepre,filewritepre *.{c,cc,cpp,h,hpp} call InsertModifiedDateIfRequired() + function! s:InsertHeaderGates() let gatename = substitute(toupper(expand("%:t")), "\\.", "_", "g") execute "normal! ggO#ifndef " . gatename