用这个配置需要下载 molokai主题 和 vimtweak.dll(半透明设置)
这个配置实现的功能:
-
高亮
-
括号匹配
-
F9编译运行
-
半透明
-
显示行号
等
抄自队友..click here
"--- Encoding ---"
set encoding=utf-8
set termencoding=utf-8
set fileencoding=utf-8
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
language messages zh_CN.utf-8
"--- Tab ---"
set noexpandtab " 不将 tab 转换成空格
autocmd FileType python set expendtab " python 则 tab 转空格
set tabstop=4 " tab 宽度为 4 个空格
set softtabstop=4
set shiftwidth=4
set smartindent " 智能缩进
set cindent " C/C++ 风格缩进
"--- Theme ---"
syntax enable
syntax on
set number " 显示行号
set ruler " 显示位置
set guifont=Consolas:h13:cANSI " 英文字体
set guifontwide=YouYuan:h13 " 中文字体
filetype plugin indent on " 自动探测文件类型
if has ("gui_running")
colorscheme molokai " gVim 用 molokai 主题
set cursorline " 高亮当前行
else
colorscheme desert " vim 用 desert 主题
endif
"--- Setting ---"
set autoread " 文件在别的地方被改,则自动重新加载
set nobackup " 不产生备份文件
set hlsearch " 高亮匹配的字符串
"--- Mapping ---"
noremap <F9> :call Compile_Kazusa()<CR>
inoremap <F9> <ESC>:call Compile_Kazusa()<CR>
vnoremap <C-c> "+y
vnoremap <C-x> "+x
"--- Compiling Function ---"
func! Compile_Kazusa()
exec "w"
if &filetype == 'c'
exec "! gcc % -o %<"
exec "! %<"
elseif &filetype == 'cpp'
exec "! g++ % -o %<"
exec "! %<"
elseif &filetype == 'java'
exec "! javac %"
exec "! java %<"
elseif &filetype == 'python'
exec "! python %"
endif
endfunc
inoremap ( ()<ESC>i
inoremap [ []<ESC>i
inoremap { {}<ESC>i
autocmd Syntax html,vim inoremap < <lt>><Esc>i| inoremap > <c-r>=ClosePair('>')<CR>
inoremap ) <c-r>=ClosePair(')')<CR>
inoremap ] <c-r>=ClosePair(']')<CR>
inoremap } <c-r>=CloseBracket()<CR>
inoremap " <c-r>=QuoteDelim('"')<CR>
inoremap ' <c-r>=QuoteDelim("'")<CR>
function ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "<Right>"
else
return a:char
endif
endf
function CloseBracket()
if match(getline(line('.') + 1), 's*}') < 0
return "<CR>}"
else
return "<Esc>j0f}a"
endif
endf
function QuoteDelim(char)
let line = getline('.')
let col = col('.')
if line[col - 2] == "\"
return a:char
elseif line[col - 1] == a:char
return "<Right>"
else
return a:char.a:char."<Esc>i"
endif
endf
"自动透明 "
au GUIEnter * call libcallnr("vimtweak.dll", "SetAlpha", 234)