Created
August 11, 2012 12:46
-
-
Save Osse/3324231 to your computer and use it in GitHub Desktop.
Insert_header_guards()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let header = ['#ifndef ', '# define ', '#endif ' ] | |
function! Insert_header_guards() | |
let basename=substitute(@%, "[^/]*/", "", "g") | |
let underscored=tr(basename, ".", "_") | |
let const=substitute(underscored, ".*", "\\U\\0", "")."_" | |
call setline(1, map(g:header, 'v:val . const')) | |
call append('$', ['','','','#endif ' . const]) | |
5 | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment