Change vim c header template
This commit is contained in:
parent
60f26aab28
commit
2a1cb4ef0c
13
vimrc
13
vimrc
|
@ -481,10 +481,11 @@ EOS
|
|||
endfunction
|
||||
|
||||
function! s:InsertCHeaderGates()
|
||||
let l:gatename = substitute(toupper(expand("%:t")), "\\.", "_", "g")
|
||||
call append(0, '#ifndef '. l:gatename)
|
||||
call append(line('$'), '#define '. l:gatename)
|
||||
call append(line('$'), '#endif')
|
||||
call append(0, '#pragma once')
|
||||
"let l:gatename = substitute(toupper(expand("%:t")), '\\.', '_', 'g')
|
||||
"call append(0, '#ifndef '. l:gatename)
|
||||
"call append(line('$'), '#define '. l:gatename)
|
||||
"call append(line('$'), '#endif')
|
||||
endfunction
|
||||
|
||||
" sh template
|
||||
|
@ -547,8 +548,8 @@ EOS
|
|||
autocmd BufNewFile *.sh call append(0, s:ShellScriptTemplate())
|
||||
|
||||
" C/C++ file.
|
||||
autocmd BufNewFile *.{c,cc,cpp,h,hpp} call append(0, s:CFileTemplate())
|
||||
autocmd BufNewFile *.{h,hpp} call s:InsertCHeaderGates()
|
||||
autocmd BufNewFile *.{c,cc,cpp,h,hpp,inl} call append(0, s:CFileTemplate())
|
||||
autocmd BufNewFile *.{h,hpp,inl} call s:InsertCHeaderGates()
|
||||
augroup END
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
|
Loading…
Reference in New Issue
Block a user