source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
"主题设置
"colorscheme solarized
"set bg=dark
"字体设置
set guifont=Meslo_LG_S:h10:cANSI
"高亮列
"set cc=81
"块选择快速跳转问题
set virtualedit=block
set nostartofline
"忘了这个了,好像是解决vim显示特殊字符的问题,不过貌似要字体支持
set ambiwidth=double
"侦测文件类型
filetype on
"自动对齐
set autoindent
"显示标尺
set ruler
"搜索时忽略大小写
set ignorecase
"搜索时输入的词句的逐字符高亮
set incsearch
"高亮显示匹配的括号
"set showmatch
"手动备份:set backup, w ,文件后缀自动改为*.bak
set backupext=.bak
"源代码修改之前自动备份,后缀名为.orig
"set patchmode=.orig
"行号
"set number
"语法高亮
syntax enable
"释放ctrl+y
unmap<C-y>
"编码设置
"set encoding=chinese
set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,chinese,cp936
set nobackup
set noswapfile
"半透明,win下需要下载专用dll文件,不过会影响速度
"au GUIEnter * call libcallnr("vimtweak.dll","SetAlpha",210)
"折叠设置
"设置手工折叠
set foldmethod=manual
"set foldcolumn=4
"当前高亮行
set cursorline
"高亮当前列
set cursorcolumn
"文件修改后自动载入
set autoread
"光标移动到buffer顶端和尾端保持3行距离
set scrolloff=3
"状态行显示的内容
set statusline=%<%F\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ %h%m%r%=%-14.(%l,%c%V%)\ %P
"总是显示状态栏
set laststatus=2
"改变竖屏切分时候分割线的样式
set fillchars=vert:\ ,stl:\ ,stlnc:\
"隐藏菜单栏和工具栏
"set go=
"set go+=r
set go=right
language mes en
"快捷键映射
"映射tab切换 ctrl+j 向左,ctrl+k 向右
nnoremap <C-j> <Esc>gT
nnoremap <C-k> <Esc>gt
inoremap <C-j> <Esc>gT
inoremap <C-k> <Esc>gt
set timeout timeoutlen=200
""""""""""""""""""""""""""""""插件设置区域"""""""""""""""""""""""""""""
"vundle
set rtp+=$VIM/vimfiles/bundle/vundle/
call vundle#rc('$VIM/vimfiles/bundle/')
Bundle 'https://github.com/scrooloose/nerdtree.git'
"Bundle 'https://github.com/Lokaltog/vim-powerline.git'
Bundle 'https://github.com/jistr/vim-nerdtree-tabs.git'
Bundle 'https://github.com/vim-scripts/The-NERD-Commenter.git'
Bundle 'https://github.com/vim-scripts/neocomplcache.git'
Bundle 'https://github.com/vim-scripts/bufexplorer.zip.git'
Bundle 'https://github.com/tpope/vim-unimpaired.git'
"目录树
nnoremap <F7> <Esc>:NERDTree<Enter>
let g:nerdtree_tabs_open_on_gui_startup=0
"buffer浏览配置
nnoremap <F6> <Esc>:BufExplorer<Enter>
"补全插件设置
let g:neocomplcache_enable_at_startup = 1
"快速注释插件
let mapleader=","
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
"快捷键F5调用编译器
map <F5> :call CompileRunGcc()<CR>
function! CompileRunGcc()
exec "w"
if &filetype == 'c'
exec "!g++ % -o %<"
exec "! ./%<"
elseif &filetype == 'cpp'
exec "!g++ % -o %<"
exec "! ./%<"
elseif &filetype == 'java'
exec "!javac %"
exec "!java %<"
elseif &filetype == 'sh'
:!./%
elseif &filetype == 'python'
exec "!python %"
exec "!python %<"
endif
endfunc