分享我的VIM配色和配置

molokai

” disable VI’s compatible mode..
set nocompatible

” set encoding=utf-8
set fileencodings=utf-8,ucs-bom,gbk,default,latin1

” use chinese help
set helplang=cn

source $VIMRUNTIME/vimrc_example.vim
“source $VIMRUNTIME/mswin.vim
“behave mswin

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

” autoload _vimrc
autocmd! bufwritepost _vimrc source %

” Enable syntax highlight
syntax enable

” Show line number
set nu

“与windows共享剪贴板
set clipboard+=unnamed

au FileType html,python,vim,javascript setl shiftwidth=2
au FileType html,python,vim,javascript setl tabstop=2
au FileType java,php setl shiftwidth=4
au FileType java,php setl tabstop=4

” Sets how many lines of history VIM har to remember
set history=400

” Set to auto read when a file is changed from the outside
set autoread

” Have the mouse enabled all the time:
set mouse=a

” set 7 lines to the curors – when moving vertical..
set so=7

” The commandbar is 2 high
set cmdheight=1

” Ignore case when searching
” set ignorecase
set incsearch

” No sound on errors.
set noerrorbells
set novisualbell
set t_vb=

” How many tenths of a second to blink
set mat=4

” Highlight search things
set hlsearch

” Turn backup off
set nobackup

” switch buffers with Tab
map <C-Tab> :bn<CR>
map <S-Tab> :bp<CR>

if has(“gui_running”)
set guifont=Consolas:h12
” set color schema
“colorscheme earendel
colorscheme molokai
endif

set autoindent

set dictionary-=$VIM/funclist.txt dictionary+=$VIM/funclist.txt
set complete-=k complete+=k

“Auto completion using the TAB key
“This function determines, wether we are on
“the start of the line text(then tab indents)
“or if we want to try auto completion
function! InsertTabWrapper()
let col=col(‘.’)-1
if !col || getline(‘.’)[col-1] !~ ‘\k’
return “\<TAB>”
else
return “\<C-N>”
endif
endfunction

“Remap the tab key to select action with InsertTabWrapper
inoremap <TAB> <C-R>=InsertTabWrapper()<CR>

“set list
“set listchars=tab:>-,trail:-

filetype on

set tags=tags;
set autochdir
set nohls

“Toggle Menu and Toolbar
set guioptions-=m
set guioptions-=T
map <silent> <F2> :if &guioptions =~# ‘T’ <Bar>
\set guioptions-=T <Bar>
\set guioptions-=m <bar>
\else <Bar>
\set guioptions+=T <Bar>
\set guioptions+=m <Bar>
\endif<CR>
“显示完整路径
set laststatus=2
set statusline=%F%m%r,%Y,%{&fileformat}\ \ \ ASCII=\%b,HEX=\%B\ \ \ %l,%c%V\ %p%%\ \ \ [\ %L\ lines\ in\ all\ ]
” 不要用空格代替制表符
set noexpandtab

set ff=unix

发表评论

电子邮件地址不会被公开。 必填项已用*标注