| — |
linux:vim:vimrc-donghua [2018/04/13 03:09] (当前版本) admin |
||
|---|---|---|---|
| 行 1: | 行 1: | ||
| + | ====== Donghua's vimrc file ====== | ||
| + | <file> | ||
| + | |||
| + | set nocompatible | ||
| + | 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 | ||
| + | |||
| + | |||
| + | set nocompatible | ||
| + | set nowrapscan | ||
| + | |||
| + | "set term=xtermc | ||
| + | colorscheme evening | ||
| + | " ON syntax highlighting | ||
| + | syntax on | ||
| + | " ON line number | ||
| + | set nu | ||
| + | "set incsearch | ||
| + | |||
| + | " set trailing whitesapce | ||
| + | "set list listchars=tab:\|_,trail:. | ||
| + | |||
| + | |||
| + | "" Highlighting whitespaces at end of line | ||
| + | highlight WhitespaceEOL ctermbg=red guibg=red | ||
| + | match WhitespaceEOL /\s\+$/ | ||
| + | highlight ErrorMsg ctermbg=red guibg=red | ||
| + | match ErrorMsg /^Error/ | ||
| + | |||
| + | " | ||
| + | "" Check for extra spaces instead of tabs at the front of the line | ||
| + | "match WhitespaceEOL /^\ \+/ | ||
| + | " | ||
| + | "" Highlight redundant whitespaces. | ||
| + | highlight RedundantSpaces ctermbg=red guibg=red | ||
| + | match RedundantSpaces /\s\+$\| \+\ze\t/ | ||
| + | |||
| + | " Move line up down | ||
| + | "map <C-Up> dd-P | ||
| + | "map <C-Down> ddp | ||
| + | |||
| + | "tabnext tabpre | ||
| + | "map <S-Left> <Esc>:tabp<Esc> | ||
| + | "map <S-Right> <Esc>:tabn<Esc> | ||
| + | |||
| + | set backspace=indent,eol,start | ||
| + | "set restorescreen | ||
| + | set t_ti=^[7^[r^[[?47h t_te=^[[?47l^[8 | ||
| + | "set ruler | ||
| + | "set rulerformat=%55(%{strftime('%a\ %b\ %e\ %I:%M\ %p')}\ %5l,%-6(%c%V%)\ %P%) | ||
| + | set virtualedit=all | ||
| + | set showmatch | ||
| + | set nows | ||
| + | |||
| + | set expandtab | ||
| + | set tabstop=2 | ||
| + | set shiftwidth=2 | ||
| + | set autoindent | ||
| + | |||
| + | "set smartindent | ||
| + | "set ignorecase | ||
| + | set ignorecase smartcase | ||
| + | "set expandtab | ||
| + | "set noexpandtab | ||
| + | |||
| + | "set formatoptions=croq | ||
| + | "set formatoptions=tcrq | ||
| + | |||
| + | " -- JFlex | ||
| + | augroup filetype | ||
| + | au BufRead,BufNewFile *.flex,*.jflex set filetype=jflex | ||
| + | augroup END | ||
| + | au Syntax jflex so ~/.vim/syntax/jflex.vim | ||
| + | |||
| + | " beep control | ||
| + | " set vb t_vb= | ||
| + | set vb | ||
| + | |||
| + | abbr hte the | ||
| + | iabbr #b /*************************************************************** | ||
| + | iabbr #e <Space>***************************************************************/ | ||
| + | iabbr #c# ################################################################ | ||
| + | iabbr #c* #*************************************************************** | ||
| + | iabbr #c- #--------------------------------------------------------------- | ||
| + | |||
| + | set virtualedit=all | ||
| + | |||
| + | "syn keyword szhangTodo TODO FIXME XXX TBD NYI ANNOTATION ABSTRACT contained | ||
| + | "hi link szhangTodo Todo | ||
| + | set nobackup | ||
| + | |||
| + | "danquan | ||
| + | map <F3> :%s#[A-Z0-9]\{8,\}#<span class="coupon"> & </span>#g | ||
| + | </file> | ||
| + | |||
| + | |||
| + | {{ :linux:vim:donghua.vim.tar.gz |}} | ||