" 语法高亮度显示
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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了