前端之家收集整理的这篇文章主要介绍了
vim文件配置,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
set shortmess=atI " 启动的时候不显示那个援助乌干达儿童的提示
Syntax enable
Syntax on " 语法高亮
autocmd InsertEnter * se cul " 用浅色高亮当前行
set showcmd " 显示输入的命令
set laststatus=1 " 启动显示状态行(1),总是显示状态行(2)
set foldenable " 允许折叠
set foldmethod=manual " 手动折叠
set background=dark " 背景使用黑色
filetype on " 侦测文件类型
filetype plugin on " 载入文件类型插件
set backspace=indent,eol,start " 使回格键(backspace)正常处理indent,start等
set whichwrap+=<,>,h,l " 允许backspace和光标键跨越行边界
set number " 显示行号
set tabstop=4 " Tab键的宽度
set expandtab " 用空格代替制表符
set hidden
set smartindent " 为C程序提供自动缩进
set cmdheight=1 " 命令行(在状态行下)的高度,设置为1
set showmatch " 高亮显示匹配的括号
set helplang=cn " 显示中文帮助
set nocompatible " 使用vim自己的模式
autocmd FileType c,cpp map <buffer> <leader><space> :w<cr>:make<cr>
set completeopt=preview,menu "打开文件类型检测
set confirm " 在处理未保存或只读文件的时候,弹出确认
set autoindent " 自动缩进
set hlsearch " 搜索逐字符高亮
set tags=tags
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8
"新建.c,.h,.sh,.java文件,按F12,自动插入文件头
map <F12> ms:call TitleDet()<cr>'s
function AddTitle()
call append(0,"/*******************************************************************")
call append(1,"#")
call append(2,"# Author : John ke - keyue654321@163.com ")
call append(3,"# Last modified: ".strftime("%Y-%m-%d %H:%M"))
call append(4,"# Filename : ".expand("%:t"))
call append(5,"# Description : ")
call append(6,"# ")
call append(7,"********************************************************************/")
call append(8," ")
echohl WarningMsg | echo "Successful in adding the copyright." | echohl None
endf
function UpdateTitle()
normal m'
execute '/# *Last modified:/s@:.*$@\=strftime(":\t%Y-%m-%d %H:%M")@'
normal ''
normal mk
execute '/# *Filename:/s@:.*$@\=":\t\t".expand("%:t")@'
execute "noh"
normal 'k
echohl WarningMsg | echo "Successful in updating the copy right." | echohl None
endfunction
function TitleDet()
let n=1
while n < 10
let line = getline(n)
if line =~ '^\#\s*\S*Last\smodified:\S*.*$'
call UpdateTitle()
return
endif
let n = n + 1
endwhile
call AddTitle()
endfunction
原文链接:https://www.f2er.com/bash/392101.html