---
title: "我的vim配置文件"
author: "bbsunchen"
date: "2014-05-14T03:04:35Z"
tags: []
categories: ["开源软件"]
slug: "vim"
draft: false
lastmod: "2014-08-23T00:31:23Z"
id: 2066115
url: "https://bbsunchen.iteye.com/blog/2066115"
---

```
colorscheme delek
set background=dark
syntax enable
set number
set backspace=indent,eol,start
"set expandtab
set tabstop=4
set shiftwidth=4
set incsearch
set hlsearch
set nobackup
set listchars=tab:>-,trail:~,extends:>,precedes:<
set list

autocmd Filetype python set expandtab smarttab smartindent
autocmd Filetype java set autoindent smartindent noexpandtab cindent smarttab

autocmd Filetype c      set omnifunc=ccomplete#Complete
autocmd Filetype html   set omnifunc=htmlcomplete#CompleteTags
autocmd Filetype xml    set omnifunc=xmlcomplete#CompleteTags
autocmd Filetype python set omnifunc=pythoncomplete#CompleteTags
autocmd Filetype tex    set omnifunc=syntaxcomplete#Complete

set spell spelllang=en_us
setlocal spell spelllang=en_us
highlight clear SpellBad
highlight SpellBad term=standout ctermfg=1 term=underline cterm=underline
highlight clear SpellCap
highlight SpellCap term=underline cterm=underline
highlight clear SpellRare
highlight SpellRare term=underline cterm=underline
highlight clear SpellLocal
highlight SpellLocal term=underline cterm=underline

:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {}<ESC>i
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap " ""<ESC>i
:inoremap ' ''<ESC>i
:inoremap ` ``<ESC>i
function ClosePair(char)
    if getline('.')[col('.') - 1] == a:char
        return "\<Right>"
    else
        return a:char
    endif
endf

set foldenable
set foldmethod=syntax
set foldlevel=100
nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc':'zo')<CR>
```