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