VIM配置

将tab转换成4个空格,配置这里备份一下

set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set autoindent
set encoding=utf-8
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set number
set hls 

autocmd BufNewFile *.[ch],*.hpp,*.cpp,Makefile,*.mk,*.sh exec ":call SetTitle()" 
func SetComment()
	call setline(1,"/*================================================================") 
	call append(line("."),   "*   Copyright (C) ".strftime("%Y")." Huiyi Securities Ltd. All rights reserved.")
	call append(line(".")+1, "*   ") 
	call append(line(".")+2, "*   文件名称:".expand("%:t")) 
	call append(line(".")+3, "*   创 建 者:werflychen")
	call append(line(".")+4, "*   创建日期:".strftime("%Y年%m月%d日")) 
	call append(line(".")+5, "*   描    述:") 
	call append(line(".")+6, "*")
	call append(line(".")+7, "================================================================*/") 
	call append(line(".")+8, "")
	call append(line(".")+9, "")
endfunc
func SetComment_sh()
	call setline(3, "#================================================================") 
	call setline(4, "#   Copyright (C) ".strftime("%Y")." Sangfor Ltd. All rights reserved.")
	call setline(5, "#   ") 
	call setline(6, "#   文件名称:".expand("%:t")) 
	call setline(7, "#   创 建 者:werflychen")
	call setline(8, "#   创建日期:".strftime("%Y年%m月%d日")) 
	call setline(9, "#   描    述:") 
	call setline(10, "#")
	call setline(11, "#================================================================")
	call setline(12, "")
	call setline(13, "")
endfunc 

func SetTitle()
	if &filetype == 'make' 
		call setline(1,"") 
		call setline(2,"")
		call SetComment_sh()
 
	elseif &filetype == 'sh' 
		call setline(1,"#!/system/bin/sh") 
		call setline(2,"")
		call SetComment_sh()
		
	else
	     call SetComment()
	     if expand("%:e") == 'h' 
		  call append(line(".")+10, "#ifndef __".toupper(expand("%:t:r"))."_H__") 
		  call append(line(".")+11, "#define __".toupper(expand("%:t:r"))."_H__") 
		  call append(line(".")+12, "") 
		  call append(line(".")+12, "") 
		  call append(line(".")+13, "#endif //".toupper(expand("%:t:r"))."_H") 
 
	     endif
	endif
endfunc

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值