Skip to content

Instantly share code, notes, and snippets.

@sanpingz
Last active December 17, 2015 12:29
Show Gist options
  • Save sanpingz/5610014 to your computer and use it in GitHub Desktop.
Save sanpingz/5610014 to your computer and use it in GitHub Desktop.
vim配置文件(linux)
set nocompatible
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
"colorscheme desert
"set background=dark
"colorscheme solarized "https://github.com/altercation/vim-colors-solarized
colorscheme molokai "http://www.vim.org/scripts/script.php?script_id=2340
"set guifont=Courier\ New:h11
set guifont=Consolas:h11
set tabstop=4
set shiftwidth=4
set autoindent
set backspace=2
set cindent shiftwidth=4
set smartindent
set ai!
set nu!
set showmatch
set mouse=a
set ruler
set incsearch
set hlsearch
set incsearch
set nowrapscan
set nocompatible
"set cursorline
set hidden
set list
set listchars=tab:\|\ ,
set writebackup
set nobackup
set autochdir
set nowrap
set foldmethod=syntax
set foldlevel=100
syntax enable
"set encoding=utf-8
"set fileencodings=utf-8,cp936,gbk,gb18030,big5,latin1
set laststatus=2
set cmdheight=1
if has("gui_running")
"au GUIEnter * simalt ~x
set lines=35 columns=110
"set guioptions-=m
set guioptions-=T
"set guioptions-=L
"set guioptions-=r
"set guioptions-=b
"set showtabline=0
endif
: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 > <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
au BufRead,BufNewFile *.txt setlocal ft=txt
let g:vimrc_author='Calvin'
let g:vimrc_email='sanping.zhang@alcatel-lucent.com'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment