.vimrc

在终端下使用vim进行编辑时,默认情况下,编辑的界面上是没有显示行号、语法高亮度显示、智能缩进等功能的。为了更好的在vim下进行工作,需要手动设置一个配置文件:.vimrc。

在启动vim时,当前用户根目录下的.vimrc文件会被自动读取,该文件可以包含一些设置甚至脚本,所以,一般情况下把.vimrc文件创建在当前用户的根目录下比较方便,即创建的命令为:

$vi ~/.vimrc

2.然后粘贴下列选项设置:[摘自网络]
syntax on “自动语法高亮
“winpos 5 5 ” 设定窗口位置
“set lines=40 columns=155 ” 设定窗口大小
set nu ” 显示行号
set go= ” 不要图形按钮
“color asmanian2 ” 设置背景主题
set guifont=Courier_New:h10:cANSI ” 设置字体
“syntax on ” 语法高亮
autocmd InsertLeave * se nocul ” 用浅色高亮当前行
autocmd InsertEnter * se cul ” 用浅色高亮当前行
set ruler ” 显示标尺
set showcmd ” 输入的命令显示出来,看的清楚些
“set cmdheight=1 ” 命令行(在状态行下)的高度,设置为1
“set whichwrap+=<,>,h,l ” 允许backspace和光标键跨越行边界(不建议)
“set scrolloff=3 ” 光标移动到buffer的顶部和底部时保持3行距离
set novisualbell ” 不要闪烁(不明白)
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%l,%v][%p%%]\ %{strftime(\”%d/%m/%y\ -\ %H:%M\”)} “状态行显示的内容
set laststatus=1 ” 启动显示状态行(1),总是显示状态行(2)
set foldenable ” 允许折叠
set foldmethod=manual ” 手动折叠
“set background=dark “背景使用黑色
set nocompatible “去掉讨厌的有关vi一致性模式,避免以前版本的一些bug和局限
” 显示中文帮助
if version >= 603

set helplang=cn
set encoding=utf-8

endif
” 设置配色方案
“colorscheme murphy
“字体
“if (has(“gui_running”))
” set guifont=Bitstream\ Vera\ Sans\ Mono\ 10
“endif

set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936
set fileencoding=utf-8”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”
“”“”“新文件标题”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“””
“新建.c,.h,.sh,.java文件,自动插入文件头
autocmd BufNewFile .cpp,.[ch],.sh,.java exec “:call SetTitle()”
“”定义函数SetTitle,自动插入文件头
func SetTitle()
“如果文件类型为.sh文件
if &filetype == ‘sh’
call setline(1,”#########################################################################”)
call append(line(“.”), “# File Name: “.expand(“%”))
call append(line(“.”)+1, “# Author: zll”)
call append(line(“.”)+2, “# mail: zhnlion@126.com”)
call append(line(“.”)+3, “# Created Time: “.strftime(“%c”))
call append(line(“.”)+4, “#########################################################################”)
call append(line(“.”)+5, “#!/bin/bash”)
call append(line(“.”)+6, “”)
else
call setline(1, “/***************************************************************”)
call append(line(“.”), ” > File Name: “.expand(“%”))
call append(line(“.”)+1, ” > Author: zll”)
call append(line(“.”)+2, ” > Mail: zhnllion@126.com “)
call append(line(“.”)+3, ” > Created Time: “.strftime(“%c”))
call append(line(“.”)+4, ” **************************************************************/”)
call append(line(“.”)+5, “”)
endif
if &filetype == ‘cpp’
call append(line(“.”)+6, “#include”)
call append(line(“.”)+7, “using namespace std;”)
call append(line(“.”)+8, “”)
endif
if &filetype == ‘c’
call append(line(“.”)+6, “#include

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值