@coldxiangyu
2017-06-09T00:59:54.000000Z
字数 2112
阅读 1316
Vim
个人vim配置,持续更新。
source $VIMRUNTIME/vimrc_example.vim" An example for a vimrc file."" Maintainer: Bram Moolenaar <Bram@vim.org>" Last change: 2016 Jul 28"" To use it, copy it to" for Unix and OS/2: ~/.vimrc" for Amiga: s:.vimrc" for MS-DOS and Win32: $VIM\_vimrc" for OpenVMS: sys$login:.vimrc" When started as "evim", evim.vim will already have done these settings.if v:progname =~? "evim"finishendif" Get the defaults that most users want.source $VIMRUNTIME/defaults.vimif has("vms")set nobackup " do not keep a backup file, use versions insteadelseset backup " keep a backup file (restore to previous version)if has('persistent_undo')set undofile " keep an undo file (undo changes after closing)endifendifif &t_Co > 2 || has("gui_running")" Switch on highlighting the last used search pattern.set hlsearchendif" Only do this part when compiled with support for autocommands.if has("autocmd")" Put these in an autocmd group, so that we can delete them easily.augroup vimrcExau!" For all text files set 'textwidth' to 78 characters.autocmd FileType text setlocal textwidth=78augroup ENDelseset autoindent " always set autoindenting onendif " has("autocmd")" Add optional packages."" The matchit plugin makes the % command work better, but it is not backwards" compatible.if has('syntax') && has('eval')packadd matchitendifsource $VIMRUNTIME/mswin.vimbehave mswin"Toggle Menu and Toolbarset guioptions-=mset guioptions-=Tset numberset writebackupset noundofileset nobackupset noswapfilecolo eveningset fileencodings=ucs-bom,utf-8,utf-16,gbk,big5,gb18030,latin1map :if &guioptions =~# 'T'\set guioptions-=T\set guioptions-=m\else\set guioptions+=T\set guioptions+=m\endifset diffexpr=MyDiff()function MyDiff()let opt = '-a --binary 'if &diffopt =~ 'icase' | let opt = opt . '-i ' | endifif &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endiflet arg1 = v:fname_inif arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endiflet arg2 = v:fname_newif arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endiflet arg3 = v:fname_outif arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endifif $VIMRUNTIME =~ ' 'if &sh =~ '\<cmd'if empty(&shellxquote)let l:shxq_sav = ''set shellxquote&endiflet cmd = '"' . $VIMRUNTIME . '\diff"'elselet cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'endifelselet cmd = $VIMRUNTIME . '\diff'endifsilent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3if exists('l:shxq_sav')let &shellxquote=l:shxq_savendifendfunction