我的vim配置

source $VIMRUNTIME/vimrc_example.vim
set nocompatible "关闭vi兼容模式,不模拟vi行为
set cursorline "设置当前行高亮
set nobackup "关闭自动备份功能,即保存后不产生~文件
"set noswapfile "不产生交换文件,交换文件在打开文件时自动生成,在关闭文件时自动删除
"交换文件用于检测是否重复打开文件
set shiftwidth=4 "设置每级缩进量
set softtabstop=4 "设置tab缩进量
set ignorecase "搜索忽略大小写
set guioptions-=T "隐藏工具栏
set guioptions-=r "隐藏右侧滚动条
set guioptions-=m "隐藏菜单栏
set nu "显示行号
set scrolloff=3 "光标移动到页面的顶部和底部时保持3行距离
set noundofile "禁止生成un~文件,该文件可使关闭编辑文件后再打开还可以撤销上次更改
"set undodir=$VIMRUNTIME/undofile
colorscheme desert
map <F4> :w<cr>:!%<cr>
map <F5> :w<cr>:!gcc -o %:r %<cr>:!%:r
map <F8> :w<cr>:!python %
map <C-z> <esc>I<!--<esc>A--><esc>j^ "html注释整行
map <C-q> <esc>^4xg_2h3x "去除html注释整行
map <C-l> Bi<<esc>Ea><esc>ByEEpF<a/<esc>2h "html标签
vmap <C-c> "+y
imap <C-v> <esc>"+p

"设置编码
set encoding=utf-8
set fileencodings=utf-8,gbk,gb18030,gk2312
set fileencoding=utf-8
set termencoding=utf-8
"解决菜单乱码
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim

language messages zh_CN.utf-8 "vim提示信息乱码的解决

set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let eq = ''
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
let cmd = '""' . $VIMRUNTIME . '\diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction

posted @ 2015-03-24 10:23  Netop  阅读(170)  评论(0)    收藏  举报