" 语法高亮度显示
syntax on
set cuc
set cul
" 设置行号
set nu
"防止中文注释乱码
set fileencoding=utf-8
set fenc=utf-8
set fencs=utf-8,usc-bom,euc-jp,gb18030,gbk,gb2312,cp936,big-5
set enc=utf-8
let &termencoding=&encoding
"设置字体
set guifont=Monospace\ 15
" 设置tab4个空格
set tabstop=4
set expandtab
"程序自动缩进时候空格数
set shiftwidth=4
"退格键一次删除4个空格
set softtabstop=4
autocmd FileType make set noexpandtab
" 在编辑过程中,在右下角显示光标位置的状态行
set ruler
" 搜索忽略大小写
set ignorecase
" vim使用自动对起,也就是把当前行的对起格式应用到下一行
set autoindent
" 依据上面的对起格式,智能的选择对起方式,对于类似C语言编写上很有用
set smartindent
" 在状态列显示目前所执行的指令
set showcmd
" 设置颜色主题
colorscheme desert
set nocompatible
set backspace=indent,eol,start
"<span style="font-size:18px;">:
set guioptions-=m "remove menu bar
set guioptions-=T "remove toolbar
set guioptions-=r "remove right-hand scroll bar
set guioptions-=L "remove left-hand scroll bar</span>
map <F5> ms:call AddAuthor()<cr>'s
function AddAuthor()
let n=1
while n < 5
let line = getline(n)
if line =~'^\s*\*\s*\S*Last\s*modified\s*:\s*\S*.*'
call UpdateTitle()
return
endif
let n = n + 1
endwhile
call AddTitle()
endfunction
function UpdateTitle()
normal m'
execute '/* Last modified\s*:/s@:.*$@\=strftime(": %Y-%m-%d %H:%M")@'
normal "
normal mk
execute '/* Filename\s*:/s@:.*$@\=": ".expand("%:t")@'
execute "noh"
normal 'k
echohl WarningMsg | echo "Successful in updating the copy right." | echohl None
endfunction
function AddTitle()
call append(0,"/**********************************************************")
call append(1," * Author : wangpu")
call append(2," * Email : wangpu@powertensors.ai")
call append(3," * Last modified : ".strftime("%Y-%m-%d %H:%M"))
call append(4," * Filename : ".expand("%:t"))
call append(5," * Description : ")
call append(6," * *******************************************************/")
echohl WarningMsg | echo "Successful in adding the copyright." | echohl None
endfunction