Skip to content

Instantly share code, notes, and snippets.

@awidegreen
Created February 24, 2013 22:47
Show Gist options
  • Save awidegreen/5026082 to your computer and use it in GitHub Desktop.
Save awidegreen/5026082 to your computer and use it in GitHub Desktop.
vim header file hook to include template
fun! CppHeaderFileHook()
let l:filename = tolower(expand("%"))
let l:filename = substitute(l:filename, ".hh$","_HH_", "")
let l:filename = toupper(l:filename)
source ~/templates/cpp_header.template
execute "silent %s/FILENAME_HH_/".l:filename."/g"
endfun
autocmd BufNewFile *.hh call CppHeaderFileHook()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment